SQLSTATE[HY000] [1045] Access denied for user 'sail'@'172.20.0.7' (using password: YES) after sail artisan migrate

By: Roel
July 23, 2024

 SQLSTATE[HY000] [1045] Access denied for user 'sail'@'172.20.0.7' (using password: YES) after sail artisan migrate

This happens when you have incorrect configuration in your .env file when running Laravel Sail. 3 of the most common error are DB_HOST, DB_USERNAME, and DB_PASSWORD. Make sure you have the following default configuration by Sail

DB_HOST=mysql
DB_USERNAME=sail
DB_PASSWORD=password

If it still won't work, stop sail with 

./vendor/bin/sail down -v

Note that we have added the -v flag. This will remove not only the containers and network but as well as the volume generated by the previous incorrect configuration. This will spin a new and clean volume

About the Author

Roel
Roel

Hi, my name is Roel. I am a TALL stack developer. I created this site to document all web applications I created using the TALL stack. I exclusively built products using Laravel because I like the experience writing applications using the simplest framework/stack available.



Please login to comment.

© 2024 Talldevelopers.com, All rights reserved.