[mysql]mysql8修改root密码

原创
2019/11/04 08:27
阅读数 78
use mysql
select * from user where user='root';
update user set password=password('mysql@2020') where user='root';

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('mysql@2020') where user='root'' at line 1
  • 解决:
  • 在MySQL 8.04前,执行:SET PASSWORD=PASSWORD('[新密码]');但是MySQL8.0.4开始,这样默认是不行的。因为之前,MySQL的密码认证插件是“mysql_native_password”,而现在使用的是“caching_sha2_password”。
alter user 'root'@'localhost'identified with mysql_native_password by 'root';
flush privileges;
https://blog.csdn.net/u012232730/article/details/82417245

alter user 'root'@'localhost'identified with mysql_native_password by 'mysql@2020';
alter user 'root'@'%'identified with mysql_native_password by 'mysql@2020';
也有文章说不用flush
成功!不用flush。

改完不重启mycat没事
重启就不行了。
mysql> select count(*) from td_b_nodecode;
ERROR 1184 (HY000): Invalid DataSource:0
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部