0 votes
in Linux by
MySQL Error: : 'Access denied for user 'root'@'localhost'

$ ./mysqladmin -u root -p 'redacted'

Enter password:

mysqladmin: connect to the server at 'localhost' failed error:

'Access denied for user 'root'@'localhost' (using password: YES)'

How can I fix this?

1 Answer

0 votes
by
To fix MySQL Error: : 'Access denied for user 'root'@'localhost', you should follow these steps:

Step 1: Open and Edit /etc/my.cnf or /etc/mysql/my.cnf, according to your distro.

Step 2: Add skip-grant-tables which is under [mysqld]

Step 3: Now, Restart Mysql

You must be able to login to mysql now by using the below command mysql -u root -p

Run mysql> flush privileges;

Now, set new password by ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword'; and go back to /etc/my.cnf and remove/comment skip-grant-tables

Again, Restart Mysql, now you can login with the new password

mysql -u root -p

Related questions

0 votes
asked Dec 25, 2023 in Linux by GeorgeBell
0 votes
asked Oct 21, 2022 in Other by AdilsonLima
...