mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication解决办法
mysqlnd是个好东西。不仅可以提高与mysql数据库通信的效率,而且也可以方便的设置一些超时。如,连接超时,查询超时。
但是,使用mysqlnd的时候,有个地方需要注意。就是服务端的密码格式不能使用旧的16位的存储格式,而要使用新的41位的存储格式。
如果,服务端的密码格式是16位,那么就会报错。信息如下:
Fatal error: Uncaught exception ‘PDOException’ with message ‘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’ in /home/hailong.xhl/test.php:8
如何查看自己的密码是否符合要求,so easy。
|
1
2
3
4
5
6
7
|
mysql> select user,length(password) from mysql.user; +--------------+------------------+| user | length(password) |+--------------+------------------+| demo | 16 | | demo | 16 | +--------------+------------------+ |
上面的密码是旧的16位格式。如果想改成新的41位格式,通过以下命令就可以。
|
1
2
3
4
5
6
7
8
9
10
11
12
|
mysql>UPDATE mysql.user SET Password = PASSWORD('demo') WHERE user = 'demo';Query OK, 2 rows affected (0.00 sec)Rows matched: 2 Changed: 2 Warnings: 0mysql> select user,length(password) from mysql.user;+--------------+------------------+| user | length(password) |+--------------+------------------+| demo | 41 | | demo | 41 | +--------------+------------------+mysql> flush privileges;Query OK, 0 rows affected (0.00 sec) |
修改完密码后,还需要在配置文件中修改下old_passwords选项。把值设置为0。即,
old_passwords=0
然后重启mysql。
mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication解决办法的更多相关文章
- 解决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: ...
- 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 ...
- 【转】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 当m ...
- mysqlnd cannot connect to MySQL 4.1+
phpMyAdmin - error #2000 - mysqlnd cannot connect to MySQL 4.1+ using the old insecure authenticatio ...
- 连接mysql问题 mysqlnd cannot connect to MySQL 4.1+ using old authentication
第一篇:PHP5.3开始使用MySqlND作为默认的MySql访问驱动,而且从这个版本开始将不再支持使用旧的用户接口链接Mysql了,你可能会看到类似的提示: #2000 - mysqlnd cann ...
- 开启mysql远程访问过程中所遇常见问题的解决办法
MYSQL ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.10.210' (111) 解决方法 今天在测试MySQL的连接 ...
- 卸载MySQL以及重装卡到Start Services的解决办法(亲测有效,刚重装成功)
卸载MySQL以及重装卡到Start Services的解决办法 重装系统永远是个好办法,但是对于我们程序员来说只要一想到电脑上的环境变量和其他的配置就蔫了.所以这一条就当作是废话吧. 一般来说装My ...
- MySQL Shell无法拉起MGR集群解决办法
MySQL Shell无法拉起MGR集群解决办法 用MySQL Shell要重新拉起一个MGR集群时,可能会提示下面的错误信息: Dba.rebootClusterFromCompleteOutage ...
- mysqlnd cannot connect to MySQL 4.1+ using old authentication
报这个错误主要是因为mysql使用了老的密码格式,而程序要求使用新的格式导致的,解决办法: SET old_passwords = 0; UPDATE mysql.user SET Password ...
随机推荐
- 【LINUX/UNIX网络编程】之使用消息队列,信号量和命名管道实现的多进程服务器(多人群聊系统)
RT,使用消息队列,信号量和命名管道实现的多人群聊系统. 本学期Linux.unix网络编程的第三个作业. 先上实验要求: 实验三 多进程服务器 [实验目的] 1.熟练掌握进程的创建与终止方法: 2 ...
- HDU 5025 (BFS+记忆化状压搜索)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5025 题目大意: 迷宫中孙悟空救唐僧,可以走回头路.必须收集完钥匙,且必须按顺序收集.迷宫中还有蛇, ...
- python zip enumerate函数
zip是一个内置函数, 接受两个或多个序列,并将他们拉到一起,成为一个元组列表.每个元组包含各个序列中的一个元素. s = 'abc' t = [0,1,2] zip(s,t) >>> ...
- lucene 3.0.2 中文分词
package lia.meetlucene; import java.io.IOException; import java.io.Reader; import java.io.StringRead ...
- MySQL数据库管理常用命令
参考: http://blog.linuxeye.com/419.html 安装 利用RPM包安装MySQL 设置TCP 3306端口的iptables root密码管理 设置root用户 ...
- Lamda表达式
Lamda表达式 函数式编程的产生(匿名内部类) interface Mes{ public void speak(); } public class Lam { public static void ...
- Sql Server 2008:调试
调试T-SQL语句: 1.Debug普通T-SQL语句: SQL代码如下: use northwind go declare @i int ,@j int,@k int set @i = 1; set ...
- Tortoise SVN 不显示 Log Message 具体信息的解决方法
今天加入新项目,在 Tortoise SVN Check out 完项目之后,发现右键 show log 不显示 Log Message 的具体信息: 因为是新加入的项目,问了原来负责这个项目的同事, ...
- PHP 错误与异常 笔记与总结(4)通过 trigger_error 触发 PHP 错误
[错误抑制符@] 除了 php.ini 中 error_reporting 和 display_errors 的设置.error_reporting() 函数.ini_set() 函数 外,还可以使用 ...
- mysql 关于日期时间的字段类型
mysql日期和时间类型 mysql有5种表示时间值的日期和时间类型,分别为.DATE,TIME,YEAR,DATETIME,TIMESTAMP. TIMESTAMP类型有专有的自动更新特性, TIM ...