Linux – ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)

centoslinuxMySQLPHPUbuntu

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 6

enter image description here

PHP 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".

Best Answer

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 Question