• ADADADADAD

    MySQL5.6.x sha256_password插件登入用户时报错怎么办[ mysql数据库 ]

    mysql数据库 时间:2024-11-26 22:17:41

    作者:文/会员上传

    简介:

    【问题描述】:版本:Oracle MySQL 5.6.30添加default-authentication-plugin=sha256_password启动参数启动数据库:mysqld_safe --default-authentication-plugin=sha256_passwor

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

    【问题描述】:
    版本: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>CREATEUSERaa@localhostIDENTIFIEDBY'aa';

      Query OK, 0 rows affected (0.01 sec)

      mysql>FLUSHPRIVILEGES;

      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


    继续报同样的错误。

    【解决方案】:
    在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的方式创建的。

    MySQL5.6.x sha256_password插件登入用户时报错怎么办.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: mysqlpassword