我发现这个问题在互联网上出现了很多次,但没有一个答案能够帮助到我。
因此,我有一台本地的apache+php服务器,并尝试连接到远程mysql数据库。但是脚本返回错误信息,在错误日志中我看到:
连接脚本(只包括连接服务器的部分):
因此,我有一台本地的apache+php服务器,并尝试连接到远程mysql数据库。但是脚本返回错误信息,在错误日志中我看到:
PHP Warning: mysql_connect(): Premature end of data (mysqlnd_wireprotocol.c:553) in D:\\_SERVER\\_WWW\\project\\api\\classes\\database.php on line 13
PHP Warning: mysql_connect(): OK packet 1 bytes shorter than expected in D:\\_SERVER\\_WWW\\project\\api\\classes\\database.php on line 13
PHP Warning: 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 D:\\_SERVER\\_WWW\\project\\api\\classes\\database.php on line 13
连接脚本(只包括连接服务器的部分):
function db_connect(){
// Connect to the database server
$connection = mysql_connect("server.com:3306","username","password",true);
if (!$connection){
echo "Could not connect to the Database server, please check your settings";
die;
}
...
}
我尝试设置密码的技巧没有奏效,能否有人帮助我?
谢谢。