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:\WwwRoot\AutoDial\mysql_connect_test.php on line 7 Warning: mysql_connect(): OK packet 1 bytes shorter than expected in D:\WwwRoot\AutoDial\mysql_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

【转】Warning: mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authenticat的更多相关文章

  1. 解决Mysql报错:PHP Warning: mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication.

    最近我更新了appserv-win32-2.5.10的 PHP 5.2版本到PHP 5.3,在调用http://localhost/phpMyAdmin/时,出现如下错误:PHP Warning:   ...

  2. mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication解决办法

    mysqlnd是个好东西.不仅可以提高与mysql数据库通信的效率,而且也可以方便的设置一些超时.如,连接超时,查询超时.但是,使用mysqlnd的时候,有个地方需要注意.就是服务端的密码格式不能使用 ...

  3. mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication的解决方法

    直接命令行操作没有问题,但是PHP连接就会报上面的错误. SET old_passwords =0; USE mysql; UPDATE user SET password =PASSWORD('yo ...

  4. mysqlnd cannot connect to MySQL 4.1+

    phpMyAdmin - error #2000 - mysqlnd cannot connect to MySQL 4.1+ using the old insecure authenticatio ...

  5. 连接mysql问题 mysqlnd cannot connect to MySQL 4.1+ using old authentication

    第一篇:PHP5.3开始使用MySqlND作为默认的MySql访问驱动,而且从这个版本开始将不再支持使用旧的用户接口链接Mysql了,你可能会看到类似的提示: #2000 - mysqlnd cann ...

  6. mysqlnd cannot connect to MySQL 4.1+ using old authentication

    报这个错误主要是因为mysql使用了老的密码格式,而程序要求使用新的格式导致的,解决办法: SET old_passwords = 0; UPDATE mysql.user SET Password ...

  7. mysqlnd cannot connect 连接错误处理方法

    mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administra ...

  8. phpmyadmin mysqlnd cannot connect to

    mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administra ...

  9. php 5.3开始使用mysqlnd作为的默认mysql访问驱动

    mysqlnd成为php 5.3中的默认mysql驱动,它有如下优点: mysqlnd更容易编译: 因为它是php源码树的一个组成部分 mysqlnd和php内部机制结合更紧密,是优化过的mysql驱 ...

随机推荐

  1. loadrunner个版本历程

    1.工具介绍: LoadRunner是一种预测系统行为和性能的负载测试工具.通过以模拟上千万用户实施并发负载及实时性能监测的方式来确认和查找问题, LoadRunner能够对整个企业架构进行测试.通过 ...

  2. js:语言精髓笔记3----语句

    JS语句分类:(注意语句都是有返回值的) 声明语句: 变量声明语句: 标签声明语句: 函数声明语句: 表达式语句:(表达式加分号) 变量赋值语句:具有声明一个变量的隐式效果: 函数调用语句; 属性赋值 ...

  3. Prim POJ 2031 Building a Space Station

    题目传送门 题意:给出n个三维空间的球体,球体是以圆心坐标+半径来表示的,要求在球面上建桥使所有的球联通,求联通所建桥的最小长度. 分析:若两点距离大于两半径和的长度,那么距离就是两点距离 - 半径和 ...

  4. asp.net 未能写入输出文件--“拒绝访问”的解决办法

      概述 将网部署在IIS 7 上,访问本地磁盘路径的时候,提示"**文件拒绝访问".   解决办法   将需要访问的文件夹赋于IIS_IUSRS完全控制的权限即可,不用添加NET ...

  5. Task 实现多线程的模板

        1.Task多线程简单模板   using System; using System.Collections.Generic; using System.Threading.Tasks;   ...

  6. 【BZOJ】1600: [Usaco2008 Oct]建造栅栏(dp)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1600 说好的今天开始刷水.. 本题一开始我以为是排列组合,但是自己弱想不出来,只想到了如果四边有一条 ...

  7. 【BZOJ】1821: [JSOI2010]Group 部落划分 Group(最小生成树+贪心)

    http://www.lydsy.com:808/JudgeOnline/problem.php?id=1821 这题裸题. 本题要求最短距离最长,很明显,我们排序. 这里存在贪心,即我们把边权最小的 ...

  8. 【BZOJ】1491: [NOI2007]社交网络(floyd)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1491 囧囧囧...................... 囧1:虽然自己想到做法了,但是操作的时候, ...

  9. li:hover在ie6下失效的解决方案

    li:hover在ie6下是无效的,它只在ie7以下版本有效.要解决这个问题有两个解决方法.一个是用js来解决,但是这种方法我不喜欢,因为它必需把js代码和css代码都放在html文件中.第二种是在每 ...

  10. WebUI-自用

    一.常用插件 1.弹出框架: http://layer.layui.com/ http://layer.layui.com/mobile/ 移动端 http://aui.github.io/artDi ...