ITPub博客

首页 > 数据库 > MySQL > 【MySQL】5.6.x sha256_password插件登入用户时报错

【MySQL】5.6.x sha256_password插件登入用户时报错

原创 MySQL 作者:神谕丶 时间:2016-08-18 12:01:41 0 删除 编辑
【问题描述】:
版本:Oracle MySQL 5.6.30


添加default-authentication-plugin=sha256_password启动参数启动数据库:
  1. mysqld_safe --default-authentication-plugin=sha256_password &
或在[mysqld]中设置default-authentication-plugin=sha256_password,并启动数据库。

查看一下old_passwords选项:
  1. mysql> SELECT @@old_passwords;
  2. +-----------------+
  3. | @@old_passwords |
  4. +-----------------+
  5. | 0               |
  6. +-----------------+
  7. 1 row in set (0.00 sec)

创建测试用户并刷新授权表:
  1. mysql> CREATE USER aa@localhost IDENTIFIED BY 'aa';
  2. Query OK, 0 rows affected (0.01 sec)

  3. mysql> FLUSH PRIVILEGES;
  4. Query OK, 0 rows affected (0.00 sec)

登出,通过新创建好的用户尝试登入:
  1. [root@sAno1y ~]# mysql -uaa -paa
  2. Warning: Using a password on the command line interface can be insecure.
  3. ERROR 2061 (HY000): Authentication plugin 'sha256_password' reported error: Authentication requires SSL encryption

关闭实例,不加该参数重启:
  1. mysqld_safe &
或在[mysqld]中删除/注释掉default-authentication-plugin=sha256_password选项,并启动数据库。

继续尝试登入:

  1. [root@sAno1y ~]# mysqld_safe &
  2. [1] 14052
  3. [root@sAno1y ~]# 160818 11:54:08 mysqld_safe Logging to '/data/mysql_log/err-log.err'.
  4. 160818 11:54:08 mysqld_safe Starting mysqld daemon with databases from /data/mysql

  5. [root@sAno1y ~]# mysql -uaa -paa
  6. Warning: Using a password on the command line interface can be insecure.
  7. 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/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
微信公众号:神谕的暗影长廊

注册时间:2014-07-28

  • 博文量
    161
  • 访问量
    1195299