September 5, 2020 Category : Laravel I fetched this issue when i was new in laravel and i clone project on my bitbucket. I was tring to run my project, but when i composer update at last i had found this error : no connection could be made because the target machine actively refused it laravel. If you also found this error then Check your Database Configration (database.php). maybe you haven't setting of your database configration details. After this it will run try this, it was worked for me.... Hardik SavaniI'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency. Follow Me: We are Recommending youProblem :I am building a web application in Laravel 5. The application is supposed to get "category names" stored on a MySQL database and display a form to add new "category names". When I execute the command
According to several posts I read on stack overflow, many users encountering this error did not properly configure the .env file, which overrides the default settings for the PHP Data Object (PDO), as specified in the database.php file. The .env file is defined below:
And the mysql key within the database.php file is given as:
Oddly, when I ssh into my virtual machine and I run Tags : php,mysql,laravel,pdo Answer 1:I got this error because I forgot to start MySQL in the XAMPP controller. Answer 2:sometimes maybe caching problem:
Answer 3:I changed the ip address specified in the homestead.yaml from localhost to 192.168.10.10. Then I ran Answer 4:I'm having the same problem with Wampserver. It’s worked for me: You must change this file: "C:\wamp\bin\mysql[mysql_version]\my.ini" For example: "C:\wamp\bin\mysql[mysql5.6.12]\my.ini" And change default port 3306 to 80. (Lines 20 & 27, in both) port = 3306 To port = 80 I hope this is helpful. And then Just Go to your Control panel and start Apache & MySQL Services. Answer 5:
Come on, You cannot call "the same" such different matters like explicitly provided literal, an absent parameter or a result of some function! That's three different matters! You can say "the same" only if you provide literally same parameters in both cases:
for the shell, and
for Laravel. Answer 6:I faced the same problem and read all the answers on internet but none of them helped! finally found the answer and I hope this solution helps somebody. I just set my DB_PORT to Answer 7:Reasons can be: If you are trying to access DB from different server then most conman problem faced is DB access is restricted only for localhost/127.0.0.1 Solution: You can modify
or
I Recommend to create a db user instead of root and delete root use as It is not secure to provide DB access from any IP with root user. If you are trying to connect DB from same server: Solution: Just use TCP/IP instead of the Unix socket. You would do this by using 127.0.0.1 instead of localhost when you connect. The Unix socket might by faster and safer to use, though. After changes made you have restart mysql service
Answer 8:I changed
to
in .env file Answer 9:I had the same problem once but in my own case, I was running on the local server. I later discovered that the error:
was because i have not started Immediately I started both Answer 10:It seems obvious but, sometimes WAMP or XAMP are runnig with some problems or they are not on, so they can cause this problem. Answer 11:In windows, just turn off User Access Persimissions (UAC) .-open run -type msconfing and hit Enter -go to tools and look for.UAC -set to never notify -restart the PC, it will Remember to allow it through firewall when prompted. Answer 12:In my case I had written to the .env file in Hope it'll help someone. Answer 13:I got this error with SQLite database. Unlike in other environments, where the database file might be created if it does not exist, in Laravel, I had to manually create the database file. I created it after running my server; and this lead me to this error. After restarting the server it was OK. Answer 14:Check your XAMPP (if you're using). I got the same error over and over again until I realized that my xampp is not enabled or offline, so I enabled my xampp, then it finally works. Answer 15:I just switched to windows from ubuntu homestead and this happens. What I did was change the env to: DB_HOST=localhost DB_PORT=33060 also do: cd ~/code/project-name/ then run php artisan config:clear |