douzhan1238 2013-05-16 22:30
浏览 354

mysqlnd:无法连接MySQL 5.5.24,old_passwords为Off

I have two enviroments:

  • Dev: Windows 7, PHP 5.3.24, Apache 2.2.24
  • Production: Linux, PHP 5.4.10, Apache

Both connects to a remote MySQL 5.5.24 Server. Remote connections are allowed.

I replaced all mysql functions to mysqli. In production it connects OK, but in dev throughs the following errors:

Premature end of data (mysqlnd_wireprotocol.c:553)
OK packet 1 bytes shorter than expected
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

The weird thing that the MySQL is 5.5.24, not 4.1, and old_passwords is set Off. I even changed user's password (from hosting panel, I have no admin privileges to do it in MySQL itself).

I even tried with a newer version of PHP (5.4.15), and the problem persists.

All references I read points to outdated MySQL Server (not this case), old_password issue (again not this case because it connects OK on production).

UPDATE:

Old mysql functions don't work neither. Before changing mysql to mysqli, I was using PHP 5.2.* version, and it worked. So I'm almost sure that the problem has to do with bundled mysqlnd.

  • 写回答

1条回答 默认 最新

  • dongshao6591 2013-05-20 18:07
    关注

    If you have MySQLND there is no way to authenticate using old_passwords under no circumstances. That is the drawback of MySQLND and probably the main reason why it was not adopted and will not be adopted for a long time by mainstream and especially shared hosting companies.

    Sorry.

    Just in case you wonder why this is: The old style password is considered highly insecure so support for it was removed to force people to update their password if they want the benefits of mysqlnd.

    Fix: Update your password.

    SET old_passwords=FALSE;
    SET PASSWORD FOR 'User'@'Host'=PASSWORD('yourpassword');
    FLUSH Privileges
    

    You should also add old_passwords=0 to my.cnf and restart mysql.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)