$ ./mysqladmin -u root -p ‘redacted‘
Enter password:
mysqladmin: connect to server at ‘localhost’ failed error:
‘Access denied for user ‘root’@’localhost’ (using password: YES)’
How can I fix this?
Advertisement
Answer
- Open & Edit
/etc/my.cnfor/etc/mysql/my.cnf, depending on your distro. - Add
skip-grant-tablesunder[mysqld] - Restart Mysql
- You should be able to login to mysql now using the below command
mysql -u root -p - Run
mysql> flush privileges; - Set new password by
ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword'; - Go back to /etc/my.cnf and remove/comment skip-grant-tables
- Restart Mysql
- Now you will be able to login with the new password
mysql -u root -p