mysql8.0+修改用户密码

alter user 'root'@'%' identified by 'xxxx';
alter user 'root'@'localhost' identified by 'xxxx';

如果客户端或者php链接的时候报下面的错误
Authentication plugin 'caching_sha2_password' cannot be loaded....

执行下面的sql就可以了
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'mypwd#2018';

root@后面是user表的Host字段的内容,新安装默认是localhost,我这增加了远程访问,将localhost手动改成了%
改完了之后需要执行
flush privileges;



猜你喜欢

转载自www.cnblogs.com/JimmyBright/p/9903203.html