【发布时间】:2011-08-31 06:18:41
【问题描述】:
我刚刚开始在 PHP 项目中使用 WAMP,我得到了与这行代码相关的下一个错误:
$link=mysql_connect("localhost","myuser","mypas");
我读到我必须使用旧密码再次执行 SET PASSWORD,但在重新启动所有服务后仍然无法正常工作。我正在使用 PHP 5.3.4 和 MySQL 5.1.53 有什么帮助吗?谢谢
Warning: mysql_connect() [function.mysql-connect]: Premature end of data (mysqlnd_wireprotocol.c:554) in C:\wamp\www\CDE\includes\baseDatos.php on line 5
Call Stack
1 0.0002 667312 {main}( ) ..\index.php:0
2 0.0008 682416 include( 'C:\wamp\www\CDE\includes\seguridad.php' ) ..\index.php:2
3 0.0010 690984 include( 'C:\wamp\www\CDE\includes\baseDatos.php' ) ..\seguridad.php:2
4 0.0014 692368 mysql_connect ( ) ..\baseDatos.php:5
( ! ) Warning: mysql_connect() [function.mysql-connect]: OK packet 1 bytes shorter than expected in C:\wamp\www\CDE\includes\baseDatos.php on line 5
Call Stack
1 0.0002 667312 {main}( ) ..\index.php:0
2 0.0008 682416 include( 'C:\wamp\www\CDE\includes\seguridad.php' ) ..\index.php:2
3 0.0010 690984 include( 'C:\wamp\www\CDE\includes\baseDatos.php' ) ..\seguridad.php:2
4 0.0014 692368 mysql_connect ( ) ..\baseDatos.php:5
( ! ) 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:\wamp\www\CDE\includes\baseDatos.php on line 5
Call Stack
1 0.0002 667312 {main}( ) ..\index.php:0
2 0.0008 682416 include( 'C:\wamp\www\CDE\includes\seguridad.php' ) ..\index.php:2
3 0.0010 690984 include( 'C:\wamp\www\CDE\includes\baseDatos.php' ) ..\seguridad.php:2
4 0.0014 692368 mysql_connect ( ) ..\baseDatos.php:5
【问题讨论】:
-
请将
baseDatos.php的代码粘贴到ideone.com`并链接到这里。 -
baseDatos.php 只是一个包含以下信息的“包含文件”:ideone.com/pOvt9。如果有帮助,从 mysql.user 执行 SELECT 密码,我会得到一个 16 字节的密码,而不是原来的“mypas”。
-
数据过早结束也称为过早结束。 (对不起,忍不住)
标签: php mysql apache wamp wampserver