[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';

 

posted @ 2019-11-20 23:21  唯一客服系统开发笔记  阅读(1171)  评论(0编辑  收藏  举报