Sabonzy's avatar

SQLSTATE[HY000] [1045] Access denied for user

I uploaded laravel 5.5 to the server and updated the .env file with the database credentials but anytime the app tries to make connection with the database i get Access denied for user. Note: i can login to PhpMyAdmin using the same credentials. my env looks like this:

DB_CONNECTION=mysql
DB_HOST=mysql5019.smarterasp.net
DB_PORT=3306
DB_DATABASE=db_a2bab9_blubuk
DB_USERNAME=db_a2bab9_blubuk
DB_PASSWORD=db_password

Error message:

SQLSTATE[HY000] [1045] Access denied for user 'db_a2bab9_blubuk'@'10.10.28.214' (using password: YES) (SQL: select * from `users` where `username` = ntagoe limit 1)```
0 likes
8 replies
Sabonzy's avatar

@tomopongrac when the DB_HOST is changed to localhost the connection is refused by the server

SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it. (SQL: select * from `users` where `username` = ntagoe limit 1)
RamjithAp's avatar

First check your password then try DB_HOST=localhost or DB_HOST=yourdomain.com or DB_HOST=Server IP

Sabonzy's avatar

@RamjithAp i can login to phpmyadmin using the same credentials. i have tried all that but anything other than this DB_HOST=mysql5019.smarterasp.net throws this error SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it. (SQL: select * from `users` where `username` = ntagoe limit 1)

nandlal-tjm's avatar

Just use quotation its work for me

DB_HOST='xxxxxxx' DB_USER='xxxxxxx' DB_PASS='xxxxxxxx'

1 like

Please or to participate in this conversation.