Xabi87 Posted November 19, 2010 Share Posted November 19, 2010 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. Quote Link to comment Share on other sites More sharing options...
Xabi87 Posted November 19, 2010 Author Share Posted November 19, 2010 I forgot to say, I have also added my IP address to the remote access list on the server. Quote Link to comment Share on other sites More sharing options...
Xabi87 Posted November 20, 2010 Author Share Posted November 20, 2010 Resolved this by downgrading PHP to v5.2.11 on my computer. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.