作者:俊达
用户认证及连接错误解决
MySQL用户认证可以使用几种不同的方式,创建用户时可以制定认证方式:
create user 'username'@'%' identified with auth_plugin by 'password'
auth_plugin:
mysql_native_password
sha256_password
caching_sha2_password
如果创建用户时没有指定auth_plugin,则会根据参数default_authentication_plugin的设置来确定使用哪种认证方式。
mysql> create user 'user1'@'%' identified with 'mysql_native_password' by 'abc123';
Query OK, 0 rows affected (0.02 sec)
mysql> create user 'user2'@'%' identified with 'sha256_password' by 'abc123';
Query OK, 0 rows affected (0.02 sec)
mysql> create user 'user3'@'%' identified by 'abc123';
Query OK, 0 rows affected (0.02 sec)
mysql> select user,host,plugin from mysql.user where user in ('user1','user2','user3');
+-------+------+-----------------------+
| user | host | plugin |
+-------+------+-----------------------+

本文详细介绍了MySQL中用户认证的方式,重点讲解了caching_sha2_password认证的SSL要求及其解决办法,包括开启TLS、指定RSA公钥、从服务端获取公钥等。还提到了客户端版本过低导致的错误处理和缓存机制的清理方式。
最低0.47元/天 解锁文章
1425

被折叠的 条评论
为什么被折叠?



