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

Dunesmart's avatar

SQLSTATE[28000] [1045] Access denied for user 'root'

Dear All, I have my project ready and I have just uploaded to a shared hosting server. Everything works perfectly fine on my local machine but the page is displaying the error "SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO)"

I have checked my password and username and they are both correct. The server requirements are also as I already have 2 other Laravel sites running with the same host.

I have done php artisan config:cache php artisan cache:clear But no headway.

What could be causing this and how do I get it solved? I earnestly need a solutions as this has kept me sleepless for nights now.

0 likes
6 replies
Tray2's avatar

In your .env file you need to change the user name and password for mysql. The user root does not exist on the shared host and even if it did the password should never be empty.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=mediabase
DB_USERNAME=root
DB_PASSWORD=

Need to be updated to your password and username that you have on the shared hosting.

Dunesmart's avatar

I have done exactly that but I can not say if the server is not seeing the .env file.

Tray2's avatar

@agungmahardhika You can't expect that someone will still be here after posting a question five years ago. Create your own thread and ask your question.

1 like

Please or to participate in this conversation.