1-MySQL8 - caching_sha2_password

about caching_sha2_password

创建基于mysql_native_password的用户


-- 创建新用户
create user zhangkai@'%' identified with mysql_native_password by '123';
flush privileges;

-- 如果是已有用户,改成 mysql_native_password
alter user zhangkai@'%' identified with mysql_native_password by "123";
flush privileges;

-- 或者使用下面的update命令修改
use mysql;
update user set plugin='mysql_native_password' where user='zhangkai';
flush privileges;
select host,user,plugin from mysql.user;



mysql> select host,user,plugin from mysql.user;
+-----------+------------------+-----------------------+
| host      | user             | plugin                |
+-----------+------------------+-----------------------+
| %         | zhangkai         | mysql_native_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session    | caching_sha2_password |
| localhost | mysql.sys        | caching_sha2_password |
| localhost | root             | caching_sha2_password |
+-----------+------------------+-----------------------+
5 rows in set (0.00 sec)

参考:

posted @ 2023-02-19 11:25  听雨危楼  阅读(67)  评论(0编辑  收藏  举报