0

I have problem when I wanted to put website to hosting. I am using nette and when I want to connect I get error

PDO::__construct(): Premature end of data (mysqlnd_wireprotocol.c:553)

I am using nette framework with this db config:

dsn: 'mysql:host=dbhost;dbname=dbtable'
user: dbuser
password: dbpass

When I have tried classic connection, it is working correctly. I am not sure what to do and how to solve this.

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");
}

edit: error what I have got

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
Daew dawe
  • 99
  • 8
  • Obviously this is an issue with your specific hosting company and only their technical support can assist. Good luck. – user3741598 Jul 01 '14 at 16:34
  • what is the exact error that you are getting? Hosting companies provide very less simultaneous connection to db (at most 5). So you can debug the code, which you are using to get a connecton. – thekosmix Jul 03 '14 at 10:26
  • exact error in edit. I have tried to call set password, but did not help. To edit flag in my.cnf I have to ask my hosting provider? – Daew dawe Jul 04 '14 at 06:53
  • problem solved by provider.. thank you for help – Daew dawe Jul 04 '14 at 13:04

0 Answers0