您好,欢迎来到刀刀网。
搜索
您的当前位置:首页mysql_connect():Connectionusingold(pre-4.1.1)authentica_MySQL

mysql_connect():Connectionusingold(pre-4.1.1)authentica_MySQL

来源:刀刀网


做了一下mysql升级,开发机上mysql升级到5.6版本,结果连接一些低版本的mysql服务器报出如下异常:
Warning: mysql_connect(): Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)

异常原因在于服务器端的密码管理协议陈旧,使用的是旧有的用户密码格式存储;但是客户端升级之后采用了新的密码格式。mysql5.6版本遇到这种不一致的情况就会拒绝连接。

详见mysql手册“Server Command Options”一节中“--secure-auth"选项的说明:http://dev.mysql.com/doc/refman/5.6/en/server-options.html#option_mysqld_secure-auth


解决方法有如下三种:

1、服务器端升级启用secure_auth选项;

2、客户端连接时off掉secure_auth,即连接时加上--secure_auth=off,如:mysql -p10.51.1.11 -P3308 -uroot --secure_auth=off

3、找到对应的mysql用户把密码改为新的加密方式,PASSWORD(‘your password'),如:
SET PASSWORD FOR root=PASSWORD('123456');

对于方法二,使用在程序做相应mysql配置即可,以php为例,在php.ini中设置secure_auth=off

Copyright © 2019- gamedaodao.com 版权所有 湘ICP备2022005869号-6

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务