Database Laravel php artisan migrate connection refused Database Laravel php artisan migrate connection refused laravel laravel

Database Laravel php artisan migrate connection refused


This is really anoying, but changing DB_HOST=127.0.0.1 to DB_HOST=localhost solves the problem. Give it a try (obviously your file permission must be the right one)


The solution for me was different than anywhere else I found online.

I was unknowingly using the VM (virtual machine) version of XAMPP on Mac, which functions differently than the normal version. VM XAMPP interface looks like this.

If you are using the VM XAMPP, uninstall it and install the correct XAMPP version here.

Once I installed the new version php artisan migrate worked.


First create your database. Read more about it here: http://www.complete-concrete-concise.com/web-tools/creating-a-mysql-database-using-xampp

Let's say your new database is named: my_db.

Use this in your .env:

DB_CONNECTION=mysqlDB_HOST=127.0.0.1DB_PORT=3306DB_DATABASE=my_dbDB_USERNAME=rootDB_PASSWORD=""