[MySQL] 解决Error 1698: Access denied for user 'root'@'localhost'

前端之家收集整理的这篇文章主要介绍了[MySQL] 解决Error 1698: Access denied for user 'root'@'localhost'前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

当程序中使用root账号连接MysqL时报以下错误,但是使用命令行是可以正常连接的,那么就查询MysqL数据库的user表,查看下当前用户的密码加密方式,看看是不是unix_socket
MariaDB [MysqL]> select user,plugin from user;
+------+-------------+
| user | plugin |
+------+-------------+
| root | unix_socket |
+------+-------------+
可以更改下用户的加密方式:
update user set authentication_string=password("123456"),plugin='MysqL_native_password' where user='root';

 

猜你在找的MySQL相关文章