我一直在尝试连接到托管在别处的远程数据库,而不是我作为本地主机的 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/