-1

While trying to load my laravel project, i got this error SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known (SQL: select * from `users` where `email` =eniola@gmail.com limit 1) . From my search for answers online i figured the issue is from the database details in the .env file, however none of the solutions proposed works. here are my db details, i used valet.

DB_HOST=127.0.0.1
DB_PORT=80
DB_DATABASE=projectname
DB_USERNAME=root
DB_PASSWORD=

I already ran php artisan migrate:refresh as well as php artisan config:clear, but i get the same error

  • A mysql database is usually on port 3306, the web server is on port 80. It can't connect to your database. – aynber Jan 14 '20 at 18:21
  • Thank you for responding. It was initially on port 3306 when i figured it didn't work and decided to use 80. I am just a beginner and not very sure how to run laravel well. – Eniola Agboola Jan 14 '20 at 19:07
  • Which proposed solutions did you try. – Josh Jan 14 '20 at 20:57
  • Bascally, to cross check my db details, run php artisan config:clear to clear cache as well as close and reopen the IDE – Eniola Agboola Jan 14 '20 at 23:29

1 Answers1

0

This solved the password hashing issue with sql version 8. I added the last line of code to my .env file.

DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=db_name
DB_USERNAME=root
DB_PASSWORD=password
DB_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock```