当我想将网站托管时遇到问题。我正在使用 nette,当我想连接时出现错误
PDO::__construct():数据过早结束 (mysqlnd_wireprotocol.c:553)
我正在使用带有此数据库配置的 nette 框架:
dsn: 'mysql:host=dbhost;dbname=dbtable'
user: dbuser
password: dbpass
当我尝试经典连接时,它工作正常。我不知道该怎么做以及如何解决这个问题。
if($myslConnection = mysql_connect("dbhost", "dbuser", "dbpass")){
echo("connected");
mysql_select_db("dbtable",$myslConnection);
$result = mysql_query("SELECT * FROM news", $myslConnection);
while($resultItem = MySQL_Fetch_Row($result)){
echo $resultItem[1]."<br>";
}
}
else{
exit("not connected");
}
编辑:错误我得到了什么
Warning: PDO::__construct() [pdo.--construct]: Premature end of data (mysqlnd_wireprotocol.c:553) in /var/www/html/unix/i/y/domainname.noveranet.cz/www/info.php on line 5
Warning: PDO::__construct() [pdo.--construct]: OK packet 1 bytes shorter than expected in /var/www/html/unix/i/y/domainname.noveranet.cz/www/info.php on line 5
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2000] 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 /var/www/html/unix/i/y/domainname.noveranet.cz/www/info.php:5 Stack trace: #0 /var/www/html/unix/i/y/domainname.noveranet.cz/www/info.php(5): PDO->__construct('mysql:host=tran...', 'user', 'pass') #1 {main} thrown in /var/www/html/unix/i/y/domainname.noveranet.cz/www/info.php on line 5