php – 使用旧的不安全身份验证无法连接到MySQL 4.1

前端之家收集整理的这篇文章主要介绍了php – 使用旧的不安全身份验证无法连接到MySQL 4.1前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我知道有很多问题与我的同样关心,但我希望你能帮助我找出另一个解决方案.

我们正在为我们的项目使用Symfony 2.5.10,PHP 5.4.44和MysqL 4.1.20.

每当我尝试登录系统或任何涉及连接到数据库的行为(例如添加使用FOS命令的新用户)时,我收到此错误

sqlSTATE[HY000] [2000] 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

我们已经尝试将my.cnf中的old_password设置为0,重新启动MysqL,为MysqL用户设置一个新密码,并重新启动MysqL,但仍然相同.每当我们在查询窗口中运行它:

SELECT user,Length(Password) FROM MysqL.user;

它仍然显示16作为我们正在使用的用户的密码的长度.而且当检查MysqL服务器变量和设置时,旧密码为ON(即使我们已经在my.cnf中将old_password设置为0).

这可能是错的?我真的很感谢你的帮助.

更新:与此同时,我们删除数据库用户的密码以使我们能够访问数据库.但是我仍然在寻找其他解决方案,因为我在网上找到的解决方案(如删除或注释掉old_passwords = 1在my.cnf中,将old_passwords设置为0并设置新密码然后重新启动)对我来说没有效果.

另一个更新:通常,这个问题的解决方案是在MysqL中设置old_passwords,但是如PHP documentation所述,

the new MysqLnd library does not read MysqL configuration files (my.cnf/my.ini).

那么这是否意味着在my.cnf中将old_passwords设置为0是没有用的?我还没有弄清楚这个问题的解决方案.

我们需要在任何平台上进行升级?先谢谢您的帮助.

MysqL服务器5.7.6中已弃用“SET PASSWORD”.

服务器5.7.6以下的语法是,

SET PASSWORD [FOR user] = password_option
password_option: {
    PASSWORD('auth_string')
  | OLD_PASSWORD('auth_string')
  | 'hash_string'
}

服务器5.7.6及更高版本所遵循的语法是

SET PASSWORD [FOR user] = password_option
password_option: {
    PASSWORD('auth_string')
  | 'auth_string'
}

也参考 – > http://dev.mysql.com/doc/refman/5.7/en/set-password.html

原文链接:https://www.f2er.com/php/139330.html

猜你在找的PHP相关文章