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: 0 mysql> 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 ...
随机推荐
- 2015ACM/ICPC亚洲区长春站 H hdu 5534 Partial Tree
Partial Tree Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)To ...
- UVA 10779 (最大流)
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=33631 题目大意:Bob有一些贴纸,他可以和别人交换,他可以把自己 ...
- 【BZOJ】1901: Zju2112 Dynamic Rankings(区间第k小+树状数组套主席树)
http://www.lydsy.com/JudgeOnline/problem.php?id=1901 首先还是吐槽时间,我在zoj交无限tle啊!!!!!!!!我一直以为是程序错了啊啊啊啊啊啊. ...
- Struts2+Spring3+Mybatis3开发环境搭建
本文主要介绍Struts2+Spring3+Mybatis3开发环境搭建 Struts和Spring不过多介绍. MyBatis 是支持普通 SQL 查询,存储过程和高级映射的优秀持久层框架.MyBa ...
- QT快捷键
F1使用方法:选中某一类或函数,按下F1,出现帮助文档 F2使用方法:选中某一类或函数,按下F2,迅速定位到该类或函数声明的地方或被调用的地方 Ctrl+鼠标滚轮的使用方法:按住Ctrl,使鼠标滚轮旋 ...
- linux下六大IPC机制【转】
转自http://blog.sina.com.cn/s/blog_587c016a0100nfeq.html linux下进程间通信IPC的几种主要手段简介: 管道(Pipe)及有名管道(named ...
- Why Consumer Hardware Start-ups Fail
今年看到一篇文章还是很受启发. If you have the guts to start selling what you believe in, customers who share your ...
- How to: Fix a network printer suddenly showing as offline in Windows Vista, 7 or 8 « Robin's Blog
This post has become quite popular – so I've updated it with a bit more detail, plus some people's e ...
- linux下挂在u盘,移动硬盘的方法,转移服务器资料的时候,使用移动硬盘什么最方便了
本文章是在centos环境下操作的 最近linux服务器我不小心吧root下面的用户配置,不能远程登录,而且我对linux系统配置也不熟悉,最后的办法就是去了一趟机房,还好是在深圳南山科技园,不算太远 ...
- FastDFS 上传文件
[root@GW1 client]# ./fdfs_test ../conf/client.conf upload /home/tmp/1009.png This is FastDFS client ...