ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Configuration of the database does use root@localhost, and that password was chosen when you installed it for the first time. It is not the system's root password. MySQL root and system's root are different accounts with possible different passwords.
Try to remember and try to guess it by using mysql -u root -p
to try. If no luck, search Google for how to remove MySQL configuration and start anew.
Related videos on Youtube
Travis
Updated on September 18, 2022Comments
-
Travis over 1 year
So at first I was getting this error when trying to create databases for use in phpmyadmin.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
I looked in several places and a buddy of mine told me to just attempt to re install mysql since I just re-installed the server yesterday.
So I decided to re install mysql, and now I can't even run the installer without getting this error:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
I had also got the
'root'@'localhost'
error when trying to install a script with the database I created. This is the error I get when I had tried to install the script: Running Centos 6PHP 5.3.3 (Script I am using is Ioncubed, and PHP 5.4, I don't need it).
EDIT:
If you are going to question about why don't I look around first, I have looked around! I ain't having luck finding others who had the type of issue as I did.
EDIT 2:
I successfully installed MySQL now. I felt like going back and giving it another go and the installer went fine. But I still get the root@localhost error provided in the image above. I already checked to make sure the config wasn't magically using "root"@"localhost".
-
week over 10 yearsIt looks like you have a wrong password set. Did you try recovery?
-
Travis over 10 years@week I actually just edited the post. I solved the installer, I just can't figure out the root@localhost. Check "Edit 2:" at the bottom.
-
week over 10 yearsMy comment was about error
root@localhost password NO
error. Can you connect from shell as db root?
-
-
Travis over 10 yearsI do know the password, I can log into mysql perfectly fine. Not sure if you are talking about the database or the mysql root login.
-
Travis over 10 yearsMy friend said to try my root mysql login and it worked fine. I just don't get what is incorrect with my other login...
-
Travis over 10 yearsWill give this a go and report back. But actually I use to have this script installed on a HostGator server and never experienced this issue. Switched to VPS hosting for the Centos CML experience and speeds.
-
Travis over 10 yearsOk weird, everything is working fine with the database that I had set the script to now.
-
Travis over 10 yearsOk so it's not working again. I decided to do a re install with a new database.
-
Travis over 10 yearsHey Iserni I came back looking at your post to see if I could alter in in anyway to make this work. Since now it is trying to use apache@localhost I ran the command
GRANT ALL PRIVILEGES ON rgctravis.* TO apache@localhost IDENTIFIED BY 'passhere';
That changed nothing. But when I remove all text out of the password field, the script says "No Database Selected". Any suggestions? -
LSerni over 10 yearsYou also need to issue a
FLUSH PRIVILEGES
to ensure the password change "takes". If at that point it still not works, then the password you set is not the one the script is using. Maybe there are two config files (as in "a default one and an incorrectly named/placed one"). -
Travis over 10 yearsYah had done the Flush Priv's. I just installed the script on a Hostgator server and it installed 100% fine without issue, I don't think it'd mean the script magically changed when getting on my server..