title: Connection to mysql database: PDO Premature end of data
body: <p>I have problem when I wanted to put website to hosting. I am using nette and when I want to connect I get error</p>
  
  <p><strong>PDO::__construct(): Premature end of data (mysqlnd_wireprotocol.c:553)</strong></p>
  
  <p>I am using nette framework with this db config:</p>
  
  <pre><code>dsn: 'mysql:host=dbhost;dbname=dbtable'
  user: dbuser
  password: dbpass
  </code></pre>
  
  <p>When I have tried classic connection, it is working correctly. I am not sure what to do and how to solve this.</p>
  
  <pre><code>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]."&lt;br&gt;";
      }
  }
  else{
    exit("not connected");
  }
  </code></pre>
  
  <p>edit: error what I have got</p>
  
  <pre><code>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-&gt;__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
  </code></pre>