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

virgiltu's avatar

Fixed ::: "php artisan migrate" works but not website

These are the type of questions you ask when you decide to fix stuff after a few hours after a surgery . :::::

Resolution: close and rerun php artisan server

.......

I cant seem to figure out y the php artisan migrate works but not the website.

Under the website i get the nice

SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) 

Obvious i have it set correct under the .env as the migration works

I also did

php artisan cache:clear

with no luck. Is there another command i should be doing here to get it to refresh.

Background:: I had another server running and it worked before. I had to update the version and now because I have a password it does not seem to work. If i removed the password from the server it seems to work. Somewhere it seem that my .env file is getting from cache or something.

I very much appreciate it.

0 likes
1 reply
aurawindsurfing's avatar

The error says it all, it can not access the DB. There could be many reasons.

First just try to log in to it via terminal and see if everything works as expected:

mysql -u root

Does that allow you to log in to DB?

If so, check users, check permissions and then get back to Laravel.

Please or to participate in this conversation.