Warning: mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication
来源:互联网 发布:mac 抹掉磁盘 编辑:程序博客网 时间:2024/05/21 09:58
Google了许久,终于发现了解决办法。 将主机的密码设成41位。
A 万网主机空间,请按以下操作:
其它的解决办法:
然后将本地数据库的内容导入到网站的数据库中,结果就出现了如下错误信息:
Warning: mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication.
这个问题主要就是因为数据库的登陆密码编码问题,对于我们这种小站站长来说,没有虚拟服务器,更没有服务器,只有虚拟空间和有限的数据库操作权限,所以网上说的那些什么改这改那都不能用啊,更不用说联系空间服务商升级数据库了。
其实这个问题的解决办法很简单。一般情况下,虚拟的空间服务商的数据库都提供了phpMyAdmin的MySQL数据库管理工具,所以我们只要在phpMyAdmin中运行下面的两句SQL语句就行了。
SET
-SESSION-old_passwords-=-
FALSE
;
SET
-
PASSWORD
-=-
PASSWORD
(
'your-existing-password-in-plain-text'
);
不信你试试看就知道了。
用的时候将SET后面的连字符’-‘用空格替换掉就可以了,我这个博客的恶心空间服务商给装了信息过滤系统,所以直接发不了。
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.aerchi.com' ) WHERE User = 'aerchi' LIMIT 1 ;
SELECT LENGTH( PASSWORD ) FROM mysql.user WHERE User = 'aerchi';
FLUSH PRIVILEGES ;
附 PHP连接MySQL测试代码:
<?php
$con = mysql_connect("192.168.3.240:3306","aerchi",www.aerchi.com);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
?>
本文地址:http://blog.csdn.net/aerchi/article/details/45949937
- Warning: mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication
- Warning: mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication
- mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication.
- Warning: mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authenticat
- mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication
- mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication问题解决
- mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication
- mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication
- mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication错误解决办法
- 在万网虚拟主机上连接数据库出错mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication
- mysqlnd cannot connect to MySQL 4.1+ using the old insecure【解决方法】
- mysqlnd cannot connect to MySQL 4.1+ using old authentication
- php连接MySQL时产生错误:mysqlnd cannot connect to MySQL 4.1+ using old authentication
- mysqlnd连接数据库的问题(mysqlnd cannot connect to mysql 4.1+ using old ..)
- php 5.3:connection failed:SQLSTATE[HY000] [2000] mysqlnd cannot connect to MySQL 4.1+ using old auth
- MySQL 4.1+ using old authentication
- mysql_connect(): Connection using old (pre-4.1.1) authentication protocol refused
- Error: mysql error: mysql: [Warning] Using a password on the command line interface can be insecure
- 15第十二周实践项目——程序阅读
- 浏览器窗口放大缩小后页面内容居中解决方法
- HDU 1232--并查集
- Windows程序基础二:句柄、HINSTANCE句柄
- 修改Android手机的默认安装位置 为SDCard手机卡
- Warning: mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication
- 第11周项目2-职员有薪水啦(2)
- spring四种依赖注入
- 第12周 阅读程序-多重继承5
- 数据库 版本号读取
- 有根树相关知识总结之遍历二叉树(C语言描述)
- 第11周项目3-点类派生直线类
- C++构造与析构(4) - 默认构造函数
- 《C与指针》学习笔记(一)