Database Error Migrate

after php artisan migrate, theres an error I got below:

[Illuminate\Database\QueryException]
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_sc
hema.tables where table_schema = homestead and table_name = migrations)

[PDOException]
SQLSTATE[HY000] [2002] Connection refused

santiagoelie
santiagoelie
  • 2 weeks ago

bad ;env file

update ur username password

Here's my .env file

DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=homestead DB_USERNAME=homestead DB_PASSWORD=secret

I already did php artisan cache:clear and confg:clear but everytime I create project I got the same error.

What should I do? Thanks for the help!

santiagoelie said:

Here's my .env file

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

I already did php artisan cache:clear and confg:clear but everytime I create project I got the same error.

What should I do? Thanks for the help!

Is this section in your Homestead.yaml correct?:

databases:
    - homestead

Also, you could try to log into your database using SequelPro or MySQLWorkbench to test if the database exists.

FrontEndCoffee said:

santiagoelie said:

Here's my .env file

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

I already did php artisan cache:clear and confg:clear but everytime I create project I got the same error.

What should I do? Thanks for the help!

Is this section in your Homestead.yaml correct?:

databases:
   - homestead

Also, you could try to log into your database using SequelPro or MySQLWorkbench to test if the database exists.

This helps me a lot. Thanks so much! @FrontEndCoffee