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

hjortur17's avatar

Access denied for user 'root'@'localhost'

When I try to migrate to my database I always get this message:

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

And this message when I try to access MySQL in the terminal:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
0 likes
2 replies
jlrdw's avatar
jlrdw
Best Answer
Level 75

This is sometimes due to having more than one mysql installation, and or wrong db info in env. Double check this stuff.

hjortur17's avatar

The problem was more than one MySQL​ installation.

Please or to participate in this conversation.