Ubuntu: #1698 - Access denied for user 'root'@'localhost' mysql -5.7 and ubuntu-16.04


I am getting below error while logged into the phpmyadmin.

it is not a fresh installation.

I have also tried login through the command line.


mysql -u root -p     **error :** ERROR 1698 (28000): Access denied for user 'root'@'localhost'  


sudo mysql -u root -p  

I am successfully login into mysql using above command.

but not with case 1.

Mysql details:  username : root   password :   


This is because MySQL by default use local system account to login as user root. This is done with plugin “unix_socket” or it might possible that password has been changed.

To allow MySQL user root to login to PhpMyAdmin, run following commands in MySQL command prompt

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

see PhpMyAdmin


I solved the above problem with setting the plugin value in user tables

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

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »