So I have a almost bare bones Laravel 5.4 application. I ran php artisan make:auth
to scaffold the auth system. I was able to migrate the users table no problem
Migrated: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_100000_create_password_resets_table
However when I try to register it throws a SQL can't connect error
SQLSTATE[HY000] [2002] Connection refused (SQL: select count(*) as aggregate from `users` where `email` = email@email.com)
How could this be happening if I'm able to migrate the tables successfully? Even after the registrion method throws that error I'm still able to rollback the migration:
Rolled back: 2014_10_12_100000_create_password_resets_table
Rolled back: 2014_10_12_000000_create_users_table
And re-migrate the tables:
Migrated: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_100000_create_password_resets_table
So I know the PostgreSQL server is up and running.
SMALL UPDATE The same issue happens with Laravel 5.3 so it has nothing to do with the recent release of 5.4
Your problem lies in .env
file you should check your .env
file where you haven't specified username or password so it will take homestead
from database.php
check your .env
's DB section
DB_CONNECTION=mysql
DB_HOST=my ip //localhost
DB_PORT=3306
DB_DATABASE=myDBname
DB_USERNAME=root
DB_PASSWORD=my pass