加入收藏 | 设为首页 | 会员中心 | 我要投稿 源码门户网 (https://www.92codes.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

MySQL5.6.x sha256_password插件登入用户时报错咋办

发布时间:2022-01-12 13:11:14 所属栏目:MySql教程 来源:互联网
导读:MySQL5.6.x sha256_password插件登入用户时报错怎么办,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。 【问题描述】: 版本:Oracle MySQL 5.6.30 添加default-authentication-plugin=s
      MySQL5.6.x sha256_password插件登入用户时报错怎么办,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。
 
【问题描述】:
      版本:Oracle MySQL 5.6.30
 
 
添加default-authentication-plugin=sha256_password启动参数启动数据库:
 
mysqld_safe --default-authentication-plugin=sha256_password &
或在[mysqld]中设置default-authentication-plugin=sha256_password,并启动数据库。
 
查看一下old_passwords选项:
 
mysql> SELECT @@old_passwords;
+-----------------+
| @@old_passwords |
+-----------------+
|               0               |
+-----------------+
1 row in set (0.00 sec)
 
创建测试用户并刷新授权表:
 
mysql> CREATE USER aa@localhost IDENTIFIED BY 'aa';
Query OK, 0 rows affected (0.01 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
 
登出,通过新创建好的用户尝试登入:
 
[root@sAno1y ~]# mysql -uaa -paa
Warning: Using a password on the command line interface can be insecure.
ERROR 2061 (HY000): Authentication plugin 'sha256_password' reported error: Authentication requires SSL encryption
 
关闭实例,不加该参数重启:
 
mysqld_safe &
或在[mysqld]中删除/注释掉default-authentication-plugin=sha256_password选项,并启动数据库。
 
继续尝试登入:
 
 
[root@sAno1y ~]# mysqld_safe &
[1] 14052
[root@sAno1y ~]# 160818 11:54:08 mysqld_safe Logging to '/data/mysql_log/err-log.err'.
160818 11:54:08 mysqld_safe Starting mysqld daemon with databases from /data/mysql
[root@sAno1y ~]# mysql -uaa -paa
Warning: Using a password on the command line interface can be insecure.
ERROR 2061 (HY000): Authentication plugin 'sha256_password' reported error: Authentication requires SSL encryption
 
继续报同样的错误。
 
【解决方案】:
 
目前该“bug”的Status已经被置为:Closed
 
结贴的是一个叫“Paul Dubois”的小哥的评论,他表示这并不是一个bug,因为bug提交者和我一样,使用该插件时,需要通过SSL连接:
“Use of the sha256_password plugin requires that MySQL be built with SSL capabilities. See Section 6.3.9, “Using SSL for Secure Connections”.”
 
反之:如果用了该插件,又是用old_passwords=0的方式设置的密码,那么又何必多此一举使用该插件呢?
禁用该插件并重新创建需要创建的user@ip即可解决问题。
前提是其他的用户密码也是没有通过old_passwords=2的方式创建的。
 
 
 
看完上述内容,你们掌握MySQL5.6.x sha256_password插件登入用户时报错怎么办的方法了吗?

(编辑:源码门户网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!