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. NDK开发

    1 CDT 是 Eclipse 插件,它将把 Eclipse 转换为功能强大的 C/C++ IDE. C/C++在Eclipse平台下的开发工具.它提供的功能包括:C/C++编辑器(一些基本的功能:语 ...

  2. C++的那些事:函数全解析

    一.函数的结构 函数在C++中可能出现在三种地方,一是函数的定义,它包括了如上图的结构:二是函数的声明,它与函数的定义相比,没有了函数体部分:三则是函数的调用.当然,不同的函数定义可以还会稍有不同,比 ...

  3. java阿拉伯数字表示的金额转换成中文大写金额

    最大数字要处理到千亿也就是12位整数部分我们可以分成3段处理,xxxx亿,xxxx万,xxxx元,然后小数部分比较好处理我们发现0比较难处理什么时候会出现零呢那就是两个数字之间出现一个或多个零那么数字 ...

  4. DedeCMS让{dede:list}标签支持weight权重排序

    1.找到"根目录\include\arc.listview.class.php"文件. 2.修改代码:在文件第727行处添加按weight排序判断代码(红色部分为新添加代码). / ...

  5. POJ 3686 & 拆点&KM

    题意: 有n个订单,m个工厂,第i个订单在第j个工厂生产的时间为t[i][j],一个工厂可以生产多个订单,但一次只能生产一个订单,也就是说如果先生产a订单,那么b订单要等到a生产完以后再生产,问n个订 ...

  6. 使用WebRequest 检测 手机号归属地。 C#通用 使用json 和可设定超时的WebClient

    首先建立jsonObject,当然你也可以使用xml解析,目前介绍一下我使用的方法. /******************************************************** ...

  7. Xcode 编辑时的爆炸效果

    Xcode 的爆炸效果 1.打开终端输入 $mkdir -p ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins;$curl ...

  8. COJ1013 : WZJ的数据结构(十三)

    这道题有这样一个解法: 首先把边依次加到图中,若当前这条边与图中的边形成了环,那么把这个环中最早加进来的边弹出去并将每条边把哪条边弹了出去记录下来:ntr[i] = j,特别地,要是没有弹出边,ntr ...

  9. shell用到的命令

    一.shift 参数左移 until [ $# -eq 0 ]doecho "第一个参数为: $1 参数个数为: $#"shiftdone 二.wc 该命令用于统计指定文件中的字节 ...

  10. linux 快捷键

    截图: 打印: 全屏截图 alt+打印:窗口截图 shift+打印:区域截图 ctrl+打印:截图到剪贴板 显示桌面: ctrl+super+d 最大化最小化窗口 ctrl+alt+up/down 转 ...