1

I started a new Laravel 8 Project, I installed a fresh update of vagrant machine "laravel/homestead" in my project. I can "vagrant up" and I can see the mysql database created during the start.

I did "mysql -uhomestead -psecret" on ssh connection and it connect correctly, I can see my database "homestead" that is empty. I can also connect on the database with MySQL Workbench on my host machine with the adress "192.168.10.10:3306" and same credentials.

Now here my .env file :

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

But here the error message when I try to migrate :

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrations and table_type = 'BASE TABLE')

I also tried with 33060 port and I changed 127.0.0.1 by localhost...

It should work, and it worked on my previous project... I tried to destroy the machine with vagrant destroy and vagrant up again I tried to clean cache of laravel with php artisan cache:clear and config:clear etc

But always the same error ! What did I forget or misunderstand ?

Thx everyone !!

Dimitri
  • 45
  • 8

1 Answers1

4

Try deleting the DB_HOST=mysql I think that is causing the issue