[mysql]mysql8修改root密码

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
您可能感兴趣的文档:

--结束END--

本文标题: [mysql]mysql8修改root密码

本文链接: https://www.lsjlt.com/news/1823.html (转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢