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

ERROR 1698 (28000): Access denied for user ‘root’@'localhost’
转载自学习

  • 进入以下文件
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf

在如下位置,加入skip-grant-tablesNavicat Tips2 ERROR 1698 (28000): Access denied for user 'root'@'localhost'_第1张图片
保存并退出。

  • 重启mysql
    service mysql restart

  • 重新进入mysql

mysql -u root -p
use mysql;
update user set authentication_string=password(”你的密码“)where user="root";
flush privileges; 

Navicat Tips2 ERROR 1698 (28000): Access denied for user 'root'@'localhost'_第2张图片

  • 再次进入mysql
service mysql restart
mysql -u root -p
  • 如下修改
use mysql;
select user,plugin from user;

从图中可以看到在执行了select user,plugin from user后,错误原因是因为plugin root的字段是auth_socket,那我们改掉它为下面的mysql_native_password就行了。
Navicat Tips2 ERROR 1698 (28000): Access denied for user 'root'@'localhost'_第3张图片

update user set authentication_string=password('你的密码'),plugin='mysql_natice_password' where user='root';
select user,plugin from user;
  • 此时有
    Navicat Tips2 ERROR 1698 (28000): Access denied for user 'root'@'localhost'_第4张图片
  • 最后注释掉之前的输入
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf 

Navicat Tips2 ERROR 1698 (28000): Access denied for user 'root'@'localhost'_第5张图片

  • 此时即可正常进入mysql
mysql -u root -p

你可能感兴趣的:(Navicat Tips2 ERROR 1698 (28000): Access denied for user 'root'@'localhost')