mysql url secure auth_关于mysql的secure_auth

最近做服务器部署,服务器mysql的版本是5.5.37,而客户端用的mysql库是5.6.15,结果就是死活连不上,开始以为是云服务器之间的路由不通。

不过经过核实之后,和链路无关。

然后在本地调试。输出连接失败信息如下:

mysql_connect(): Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)

mysql官网给的说明

--secure-auth

Command-Line Format

--secure-auth

Option-File Format

secure-auth

System Variable Name

secure_auth

Variable Scope

Global

Dynamic Variable

Yes

Permitted Values (<= 5.6.4)

Type

boolean

Default

OFF

Permitted Values (>= 5.6.5)

Type

boolean

Default

ON

This option causes the server to block connections by clients that attempt to use accounts that have passwords stored in the old (pre-4.1) format. Use it to prevent all use of passwords employing the old format (and hence insecure communication over the network). Before MySQL 5.6.5, this option is disabled by default. As of MySQL 5.6.5, it is enabled by default; to disable it, use --skip-secure-auth. 在这2个版本之间,secure-auth选项默认值有改变,解决方法:

1、服务器这边,在my.cnf中加上

secure-auth=1

重启 service mysqld start

2、客户端这边,mysql_options(mysql,MYSQL_SECURE_AUTH,(my_bool*)0);

建议采用方案1。

参考

http://blog.csdn.net/zuyi532/article/details/10148259

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值