mysql8.0.27之后无法指定加密方式创建用户或者修改密码

mysql> create user 'admin2'@'%' identified with mysql_native_password by '123456';
4058 - 1 factor authentication method does not match against authentication policy. Please refer @@authentication_policy system variable.

原因:在 MySQL 8.0.27 中由 authentication_policy 来管理用户的身份认证:authentication_policy=caching_sha2_password,,

说明:第1个元素值是星号(*),表示可以是任意插件,默认值取 default_authentication_plugin 的值。如果该元素值不是星号(*),则必须设置为 mysql_native_password ,sha256_password ,caching_sha2_password 中的一个。

第2, 3个元素值为空,这两个位置不能设置成内部存储的插件。如果元素值为空,代表插件是可选的。

修改办法:修改配置文件my.ini,将authentication_policy=caching_sha2_password,, 改为:authentication_policy=*,,   表示支持任意加密方式。修改完后,重启mysql服务。

验证:再次验证,则可以指定mysql_native_password加密方式,创建用户。

 

修改root密码

 

 

 

参考:

https://blog.csdn.net/yangjianrong1985/article/details/123587785

 

 

 

 
posted @ 2022-10-13 11:47  小泉哥  阅读(2857)  评论(0)    收藏  举报