ERROR 1698 (28000): Access denied for user ‘root’@’localhost’

In this article, we will see solution for below error.

ERROR 1698 (28000): Access denied for user 'root'@'localhost'

ERROR 1698 (28000) Access denied for user root@localhost

Solution:

The correct way is to login to MySQL with sudo privilege.

sudo mysql -u root -p

And then updating the password using:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new-password';

Once this is done stop and start the MySQL server.

sudo service mysql stop sudo service mysql start