本文共 848 字,大约阅读时间需要 2 分钟。
现场还原:用root用户在Linux上安装mysql后,用Linux的root用户可以登录mysql,但普通用户无法登录,提示错误:ERROR 1698 (28000): Access denied for user 'root'@'localhost'
选择以mysql命名的数据库,用以下命令查看user表:
select host,user,plugin from user;
结果如下:
+-----------+---------+-----------------------+| host | user | plugin |+-----------+---------+-----------------------+| localhost | root | unix_socket |+-----------+---------+-----------------------+
update user set authentication_string=PASSWORD('000000'), plugin='mysql_native_password' where user='root';
结果如下:
+-----------+---------+-----------------------+| host | user | plugin |+-----------+---------+-----------------------+| localhost | root | mysql_native_password |+-----------+---------+-----------------------+
service mysql stop
service mysql start
转载地址:http://tuzob.baihongyu.com/