How I got this error?
Ans: I was running
php artisan migrate command in
What was the error?
ubuntu@ip-ip_addr:/opt/lampp/htdocs/project_dir$ php artisan migrate
In Connection.php line 664:
SQLSTATE[HY000]  Connection refused (SQL: select * from information_schema.tables where table_schema = db_name and table_name = migrations
In Connector.php line 67:
SQLSTATE[HY000]  Connection refused
Screenshot of the error:
1. Open .env file
2. Change the
DB_HOST=127.0.0.1 to DB_HOST=localhost
3. Make sure the port number, db name, username and password is correctly mention in the .env before saving it
4. Save the .env file then run command:
sudo artisan config:cache
5. Now, run command:
php artisan migrate
Output after applying the solution:
Thanks for reading. I hope you enjoyed the article!
- Sending Email with attachments in Laravel 5.5 using and PHP & JQuery - February 20, 2020
- How to run php artisan queue:listen in background on Ubuntu or Linux machine - February 6, 2020
- Laravel 5.5 php artisan migrate error in Ubuntu: SQLSTATE[HY000]  Connection refused - January 31, 2020