mysql - 本地主机(使用 xampp)连接到远程数据库?

标签 mysql passwords xampp localhost mysql-connect

我一直在尝试连接到托管在别处的远程数据库,而不是我作为本地主机的 PC,但每当我这样做时(使用与实时服务器完全相同的密码、主机等),我都会收到这些错误:

Warning: mysql_connect() [function.mysql-connect]: Premature end of data 
(mysqlnd_wireprotocol.c:553) in C:\xampp\htdocs\Test\auth.php on line 12

Warning: mysql_connect() [function.mysql-connect]: OK packet 1 bytes shorter 
         than expected in C:\xampp\htdocs\Test\auth.php on line 12

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 C:\xampp\htdocs\Test\auth.php on line 12

Could not connect to host: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

我做错了什么?

编辑:我还是搞不懂,我试过更新 xampp。

编辑:

SELECT Length( PASSWORD( 'xyz' ) ) 

这在我的本地主机上返回了 41,在服务器上返回了 16,所以我在 my.cnf 中添加了 old_passwords=1,重新启动了 mysql,所以现在它们都等于 16。仍然有同样的错误。

编辑:仍然一无所知,它适用于其他人但不适用于我...

编辑:尝试用谷歌搜索,尝试了一些修复;没有一个有效。

最佳答案

降级到 xampp 1.6.7(从 1.7.4) 对我有用!

关于mysql - 本地主机(使用 xampp)连接到远程数据库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7684752/

相关文章:

spring - 使用 Spring MVC 确认密码的最简单方法

php - XAMPP - MySQL 意外关闭

Mysql 主从复制

php - 点击时如何查询MYSQL?

php - MySql self Join with array in

java - 如何用java编写一个非常简单的登录系统

mysql - Moodle 2.9 中每个用户的登录次数

.net - 使用 WCF 和 DefaultCredentials 时如何处理密码更改?

ssl - 无法通过 XAMPP 生成 SSL 证书

mysql - 将 Ruby on Rails 连接到现有 MySQL 数据库(之前安装了 XAMPP)