zoukankan      html  css  js  c++  java
  • 【转】Warning: mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authenticat

    Warning: mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authenticat

    当mysql版本< 5.1时,php版本为>=5.3时,mysql_connect()会显示的是如下错误:

    Warning: mysql_connect(): Premature end of data (mysqlnd_wireprotocol.c:554) in D:WwwRootAutoDialmysql_connect_test.php on line 7 Warning: mysql_connect(): OK packet 1 bytes shorter than expected in D:WwwRootAutoDialmysql_connect_test.php on line 7 Warning: mysql_connect(): 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 

    【解决方法】
    1. 找到配置文件my.cnf(Linux,/etc/my.cnf)或my.ini(win,安装目录),打开,将其中old_passwords=1注释掉;

    2.重启mysql;
    3. 将mysql用户对应的密码重新设定一下(set password for 'user_test'@'{这里写你的地址}' = password('123456'))。

    【原因】
    有 的安装情况下,MySQL 5.0 为了和4.1之前的版本兼容,用户密码(mysql数据库的user表password字段)保存的是密码的16位hash值,而PHP5.3的 mysql驱动使用41位的密码hash值进行用户验证,所以需要让mysql中保存用户密码的41位hash值,但配置文件中 old_passwords=1的话,password()函数只能返回16位hash值。参考mysql5.0文档security章password hashing in mysql节。

    转自:http://topic.csdn.net/u/20110306/12/d6f13885-da88-46c4-a37d-eae656bf65ca.html

  • 相关阅读:
    Uva 11754(枚举+中国剩余定理)
    poj 1018(枚举+贪心)
    Uva 11021(概率)
    UVa 11426
    unittest(二)框架中的概念与断言
    unittest(一)IDE导出的代码分析
    Selenium(十五)cookie
    Selenium(十四)处理登录框的验证码
    Selenium(十三)调用js,控制浏览器的滚动条
    安装pytest
  • 原文地址:https://www.cnblogs.com/mimime/p/5981282.html
Copyright © 2011-2022 走看看