2

I start to work on a laravel project that start by colleage. once I pulled down the git I want to do migration:

php artisan migrate:refresh

Immediately I got an error:

SQLSTATE[HY000] [1045] Access denied for user 'root'@'172.19.0.1' (using password: NO) (SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE')

which seems odd because I checked all my config/database.php, .env, all point to 127.0.0.1 for mysql and not sure where 172.19.0.1 come from.

How can I debug this?

sooon
  • 4,718
  • 8
  • 63
  • 116
  • Maybe Your colleage accedentally pushed cached config to git too. It's just a guess but if it's true than `php artisan cache:clear` might help. – mzolee Jul 22 '20 at 07:55
  • Tried that. still not working. – sooon Jul 22 '20 at 08:04
  • It is not ```cache:clear``` you need, it is ```config:clear```. Please see my answer to a related question here: https://stackoverflow.com/questions/62820384/laravel-environment-variableswithout-default-value-passed-in-method-not-workin/62820726#62820726 – Kurt Friars Jul 22 '20 at 08:06
  • And did you search in your project for `172.19.0.1`? – dbf Jul 22 '20 at 09:54
  • I found out the issue. It seems like some cache project that cannot be clear by config:clear or cache:clear. I have to literally go to delete the file in config/cache/ folder to make it work. – sooon Jul 23 '20 at 09:07

1 Answers1

0

Please check your database, you have permissions issue for the database user.

Grant permissions for your db user root.

Execute the below command:

GRANT ALL PRIVILEGES ON dbname.* TO 'root'@'172.19.0.1';
FLUSH PRIVILEGES;
Ankit Jindal
  • 3,672
  • 3
  • 25
  • 37