Got error: 1698: access denied for user ‘root’@’localhost’ when trying to connect

In this article let’s discuss about Got error: 1698: access denied for user ‘root’@’localhost’ when trying to connect. Let’s go through the following methods without any delay.

Method 1:

>>> sudo mysql -u root -p

>>> USE mysql;

>>> UPDATE user SET plugin='mysql_native_password' WHERE User ='root';

>>> FLUSH PRIVILEGES;

>>> exit;

>>> service mysql restart;

If you are facing any issues with the above approach then try the alternative that is given below. It may look similar but have a try!

Method 2 :

$ sudo mysql -u root # I had to use "sudo" since is new installation

mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;

$ service mysql restart

Hope the above solution works.

Realted Posts : How to brew apps list