0

While i execute following code:

$db_host = "<IP>";  // Host name
$db_user = "<usr>";  // User name of your database
$db_password = "<pass>";     // Password of your database
$db_name="<db name>";   // Database name

$con = mysql_connect($db_host,$db_user,$db_password);
mysql_select_db($db_name) or die("Cannot select database...");

It shows following errors:

Warning: mysql_connect() [function.mysql-connect]: OK packet 6 bytes shorter than expected in C:\wamp\www\limosbusesjets\connection.php on line 21

Warning: mysql_connect() [function.mysql-connect]: mysqlnd cannot connect to MySQL 4.1+ using old authentication in C:\wamp\www\limosbusesjets\connection.php on line 21 Cannot select database...

1
  • 3
    The errors shown are missing. Could you please add them? Commented Dec 9, 2009 at 5:09

1 Answer 1

3

These errors generally happen when one is using PHP 5.3, and its new mysqlnd driver to connect to MySQL (which is often the case with PHP 5.3, as it's one of the new stuff introduced with 5.3 -- and "mysqlnd" is mentionned in your second error) : with those, you cannot connect to a MySQL database using the old-passwords system.

Which means you'll have to change the way your MySQL server deals with passwords, to switch to the "new" authentication system.

See, for instance :

Not sure it's what is causing the problem in your case, but that's one common MySQL related thing, with PHP 5.3, for those errors...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.