【问题描述】:
版本: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]中删除/注释掉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
继续报同样的错误。
【解决方案】:
在https://bugs.mysql.com/ 中找到这样一个帖子:
https://bugs.mysql.com/bug.php?id=68478
目前该“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的方式创建的。
作者微信公众号(持续更新)
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29773961/viewspace-2123662/
,如需转载,请注明出处,否则将追究法律责任。