Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

PersonalHomePage's avatar

SQLSTATE[HY000] [1045] Access denied for user

getting this weird error when I run my laravel project in docker. I'm able to connect to the database and run queries, but when laravel tries to access the database it gives me this error. Typically this is a credentials error and I'm using the same username/password. I even checked my ip because I have it whitelisted on the cloud server where the db lives. Everything seems good and like I mentioned I can actually connect to the db and run queries, but as soon as the api tries to connect it gives me this error.... any thoughts on how to troubleshoot this?

0 likes
8 replies
Sinnbeck's avatar

So both the app and database are in docker containers? On the same machine? Are you using docker-compose? What hostname is in your env file?

PersonalHomePage's avatar

@Sinnbeck I'm actually using lumen 5.6 and I tried that command, but this is what I'm getting

php artisan config:clear

                                                            
  There are no commands defined in the "config" namespace.  
Sinnbeck's avatar

@PersonalHomePage ah I thought it was laravel since you wrote that in the first post. Did you start programming yet? If not I would suggest switching to laravel :)

Please or to participate in this conversation.