mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication
发布:smiling 来源: PHP粉丝网 添加日期:2014-10-13 13:21:47 浏览: 评论:0
文章介绍了关于mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication方法,有需要了解的同学可参考一下.
- Warning: mysql_connect() [function.mysql-connect]: Premature end of data (mysqlnd_wireprotocol.c:554) in path/to/the/file/where/connection/script/is/written/
- Warning: mysql_connect() [function.mysql-connect]: OK packet 1 bytes shorter than expected in path/to/the/file/where/connection/script/is/written/
- --phpfensi.com
- Warning: mysql_connect() [function.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 in path/to/the/file/where/connection/script/is/written/
1.Change MySQL to NOT to use old_passwords
It seems that even MySQL 5.x versions still default to the old password hashes. You need to change this in “my.cnf” (e.g. /etc/my.cnf): remove or comment out the line that says:
- old_passwords = 1
- //
- old_passwords = 1为16位
- //所以这里要先
- /
- /SET old_passwords = 0;
- //这样使新密码的长度也变成41位
- Restart MySQL. If you don’t, MySQL will keep using the old password format, which will mean that you cannot upgrade the passwords using the builtin PASSWORD() hashing function. You can test this by running:
具体原因我还不是很清楚,跟old密码长度有关?先记录下来,日后研究,解决方法如下:
- SET old_passwords = 0;
- UPDATE mysql.user SET PASSWORD = PASSWORD( 'www.phpfensi.com' ) WHERE User = 'chajian8' LIMIT 1 ;
- SELECT LENGTH( PASSWORD ) FROM mysql.user WHERE User = 'chajian8';
- FLUSH PRIVILEGES ;
附,PHP连接MySQL测试代码:
- <?php
- $con = mysql_connect("192.168.3.240:3306","chajian8",www.phpfensi.com);
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- ?>
Tags: mysqlnd cannot connect
相关文章
- ·实现mysql读写分离的mysqlnd的mysqlnd_ms插件使用教程(2015-04-17)
- ·解决mysqlnd cannot connect to MySQL 4.1+ using the old insec(2015-04-20)
- ·mysql删除数据提示Cannot delete or update(2014-09-24)
- ·解决Navicat cannot proceed because system tables办法(2014-09-24)
- ·Navicat 导出mysql数据库的时候出现 “Cannot proceed because system(2015-04-18)
- ·MYSQL提示 max_open_files: 2048 max_connections: 800 table_cache: 619(2014-09-23)
- ·Mysql出现Can’t connect to MySQL server on ‘localhost’ (10061)问题(2014-09-23)
- ·Mysql "Too many connections"错误解决办法(2014-09-24)
- ·解决MySql Error:Host is blocked because of many connection errors问题(2014-09-24)
- ·Can t connect to mysql server on localhost (10061) 错误(2014-09-24)
- ·Warning:mysql_connect() [function.mysql-connect]: [2002] 由于目标机器.(2014-09-25)
- ·ERROR 1040: Too many connections问题解决办法(2014-09-28)
- ·Cant Connect MySQL Server(localhost:3306)问题(2014-09-28)
- ·MySql Lost connection to MySQL server during query问题(2014-09-28)
- ·mysql ERROR 1040: Too many connections(2014-10-02)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)