Mac error 1045 (28000): access denied for user 'root'@'localhost' (using password: no)

broken image
broken image

This could mean that the password that you entered is wrong, so, to resolve the issue, follow the steps below: Open /etc/mysql/my.cnf path from the SSH Server. Lesson learned: Do not have “$” sign on your password. While Login to the MySQL server users may encounter the given error 1045 (28000): Access denied for user ‘root’‘localhost’ (using password: YES). “ALTER USER IDENTIFIED BY 'New-Password-Here’ ”Īnd updated the php script accordingly. So I changed my mysql user password with the following command: I then noticed that in my password, before these last two characters, I have a “$” sign, which is the reserved symbol in php to indicate a variable! It was telling me something like an empty value and indicating the last 2 characters of the password. Which was showing me an error on line 3, which was the line with the password. Finally don’t know why, I ran the php file from the terminal like this instead of the browser: I was able to log-in from the terminal using the same credential and was able to see the records on the table, but the php script was showing the connection error for the same credential, which was weird!Īfter searching all the posts on stackoverflow, found no solution for this. “Error!: SQLSTATE Access denied for user” I was unable to connect to the database using the php script. I am also new in DigitalOcean and was following this article to setup a LEMP server: