Mysql fails with "Access denied for user `root`@`localhost`

Posted on

Hi,

I have read through other responses to this error and none of them work.

I am using RHEL ISO in a VM environment on virtualbox. The RHEL version is 7.9.

I have installed the mysql rpms and also installed mysql itself and the mysqld is running. When I try and access mysql with any of the following commands:

mysql
mysql -u root
mysql -u root -p

All of them fail with the error:

ERROR 1045 (28000): Access denied for user root@localhost (Using password : NO) --- the using password section can also be "YES" is I use the -p switch.

If I try without sudo I get exactly the same error except with usr instead of root in the output.

I have tried stopping and starting mysqld with no success. Mysql itself seems to have installed under /usr/bin - Just to ensure that access was good to the directory I completed a chmod 777 bin and retried with the same result.

Seems all the answers to this question in google have failed.

Responses