Jump to content

mysqlnd cannot connect to MySQL 4.1+ using old authentication


Xabi87

Recommended Posts

Hello,

 

I'm using WAMPSERVER on my PC (Windows7) and I'm trying to open a simply mysql_connect() connection in my php script to my remote MySQL database. I can connect through MySQL Query Browser fine, and everything worked fine before I moved web host recently.

 

I'm experiencing the following error, when using the mysql_connect() function, and I'm definitely using the right credentials:

 

Warning: mysql_connect() [function.mysql-connect]: OK packet 6 bytes shorter than expected in D:\wamp\www\test.php on line 3

Warning: mysql_connect() [function.mysql-connect]: mysqlnd cannot connect to MySQL 4.1+ using old authentication in D:\wamp\www\test.php on line 3
Could not connect: mysqlnd cannot connect to MySQL 4.1+ using old authentication

 

I've Googled to my heart's content, and I've read all about how people resolve this by logging into MySQL as root and resetting the password, so it uses the new hash (41 characters long) over the old has (16). I don't have root access to do this, and my webhost say they are not using old_passwords on their MySQL Server.

 

I've spoken to my webhost twice, and they've told me the problem is at my end, with the MySQL client on my computer.

 

I have the following versions, all running in the latest version of WAMPSERVER:

MySQL: 5.1.36

PHP: 5.3.0

Apache: 2.2.11

 

The versions on the remote server (hostgator shared hosting):

MySQL: 5.1.52

PHP: 5.2.4

Apache: 2.2.17

 

In MySQL Query Browser, when I run the following command:

SHOW VARIABLES LIKE 'old_passwords'

 

It returns: old_passwords ON

 

My web host said this was set somewhere on my machine, but I've gone through all my my.ini files, and there's no mention of it anywhere. I even tried setting it off by adding the line to the file, but no change.

 

Here's my php code:

<?php

	$link = mysql_connect("123.123.123.12:3306", "myusername_user", "8usJRBnIeddT");

	if (!$link) {
		die('Could not connect: ' . mysql_error());
	}
	echo "test2";
	mysql_select_db("myusername_template", $link);

	$result = mysql_query("SELECT * FROM Test", $link);
	$num_rows = mysql_num_rows($result);

	echo "<h1>num:</h1>$num_rows Rows\n";

	mysql_close($link);

?>

 

Everything is working fine when I upload the files to the server (using localhost).

 

Can anyone help me please? Spend approaching 6 hours on this one! Thank you so much.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.