【问题标题】:Mysqlnd unable to connect to MySQL 5.5 servermysqlnd 无法连接到 MySQL 5.5 服务器
【发布时间】:2013-09-25 16:30:30
【问题描述】:

我正在尝试让当前在运行 PHP 5.3.10 的开发服务器上运行的站点在本地运行。它连接到 5.5 版的 MySQL 服务器,但将 old_passwords 设置为 ON

该网站在开发服务器上运行。

在我的本地,我正在运行 PHP 5.3.26,当尝试连接时,我得到:

Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file

我知道这是 old_password 变量的问题,但它在 PHP 5.3 的开发服务器上运行。

编辑: 这是来自phpinfo()的我的本地mysql部分:

开发服务器的 mysql 部分:

如何设置本地以匹配开发服务器?

【问题讨论】:

  • 不。据我了解,mysqlnd 严格使用新的身份验证模式
  • 对我应该在开发服务器上检查什么以找出我的本地服务器和开发服务器之间的差异有什么想法吗?

标签: php mysql mysqlnd


【解决方案1】:

PHP 版本不是这里的问题,从 PHP 5.3 开始不再支持“旧”MySQL 密码。可能应用了两个不同的权限配置文件。你连接到同一台服务器吗?然后可能会发生这样的事情:

User       Host      
youruser   %           (using old-style password)
youruser   localhost   (using new-style password)

您使用相同的凭据并不一定意味着它们指的是相同的帐户或权限配置文件。

【讨论】:

  • 代码站点所在的开发服务器与数据库所在的服务器不同。所以'%'对于开发服务器和我的本地应该是一样的。
猜你喜欢
  • 2014-06-02
  • 2015-05-10
  • 2012-11-03
  • 2015-01-21
  • 2012-11-12
  • 2014-07-15
相关资源
最近更新 更多