最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

mysqlndcannotconnecttoMySQL4.1+usingtheoldinsecure

来源:动视网 责编:小采 时间:2020-11-09 09:54:43
文档

mysqlndcannotconnecttoMySQL4.1+usingtheoldinsecure

mysqlndcannotconnecttoMySQL4.1+usingtheoldinsecure:文章介绍了关于mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication方法,有需要了解的同学可参考一下。 Warning: mysql_connect() [.mysql-connect]: Premature end of data (my
推荐度:
导读mysqlndcannotconnecttoMySQL4.1+usingtheoldinsecure:文章介绍了关于mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication方法,有需要了解的同学可参考一下。 Warning: mysql_connect() [.mysql-connect]: Premature end of data (my


文章介绍了关于mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication方法,有需要了解的同学可参考一下。

Warning: mysql_connect() [.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/

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 pass 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.chajian8.com' ) WHERE User = 'chajian8' LIMIT 1 ;
SELECT LENGTH( PASSWORD ) FROM mysql.user WHERE User = 'chajian8';
FLUSH PRIVILEGES ;


附 PHP连接MySQL测试代码:

代码如下
$con = mysql_connect("192.168.3.240:3306","chajian8",);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
?>

文档

mysqlndcannotconnecttoMySQL4.1+usingtheoldinsecure

mysqlndcannotconnecttoMySQL4.1+usingtheoldinsecure:文章介绍了关于mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication方法,有需要了解的同学可参考一下。 Warning: mysql_connect() [.mysql-connect]: Premature end of data (my
推荐度:
标签: password the mysql
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top