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

Mwene's avatar

Access Denied Error

Good day, I get this error my database credentials are very correct, what could be the issue "SQLSTATE[HY000] [1045] Access denied for user 'mhago_admin'@'localhost' (using password: YES) (Connection: mysql, SQL: select * from sessions where id = Kmx9duuwQ29mBdxuKmvK5ZTAaE9E40pNlD20sxa6 limit 1) GET 172.16.80.137 PHP 8.4.5 — Laravel 12.20.0" i have confirmed my password by going into my database with mysql -u mhago_admin -p, please assist

0 likes
4 replies
Glukinho's avatar

It means the credentials is wrong, or the user doesn't have rights to a database/table.

Try to execute in mysql console:

flush privileges;

and try again.

Mwene's avatar

Like i said my credentials are not wrong and i have confirmed it by accessing the database using my user and password

Glukinho's avatar

@Mwene it means your mysql user doesn't have privileges to database/table.

Snapey's avatar

in your .env file, wrap your db password in quotes incase it contains #

If that does not work, run php artisan tinker, then enter config('database') and check the results

Please or to participate in this conversation.