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

发布于 2024-12-08 18:34:55 字数 1614 浏览 0 评论 0原文

我一直在尝试连接到其他地方托管的远程数据库,而不是我的 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').

这将在 mysql.user 中存储一个新的、更安全的哈希值。如果 该用户在 PHP 5.2 或更早版本执行的其他脚本中使用 可能需要从 my.cnf 文件中删除旧密码标志 C:\xampp\htdocs\Test\auth.php 第 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。仍然存在相同的错误。

编辑:仍然一无所知,它对其他人有效,但对我无效...

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

I've been trying to connect to a remote DB hosted elsewhere, not my my PC as localhost, but whenever I do (using the exact same password, host, etc as the live server), I get these errors:

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

What am I doing wrong?

Edit: I still can't get it, I did try updating xampp.

Edit:

SELECT Length( PASSWORD( 'xyz' ) ) 

This returned 41 on my localhost and 16 on the server, so I added old_passwords=1 in my.cnf, restarted mysql so now they both equal 16. Same errors still.

Edit: Still clueless, it works for other people but not me...

Edit: Tried googling it, tried a few fixes; none worked.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泛泛之交 2024-12-15 18:34:55

降级到 xampp 1.6.7(从 1.7.4)
为我工作!

Down-grade to xampp 1.6.7 (from 1.7.4)
Worked for me!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文