views:

2046

answers:

4

After installing Snow Leopard I got the following error when connecting to a remote MySQL server:

mysqlnd cannot connect to MySQL 4.1+ using old authentication

What I don't get is why it's working fine with MAMP when I only start MAMP's Apache, but I get this error with Snow Leopard's build in Apache. Is it because MAMP has some MySQL files locally? Do I still need to install MySQL locally when I try to connect to a remote server? Any clue as to how to fix this on my side without messing around with the server? Preferably Apache only — don't want to install anything I don't need.

Edit: solution
Turned out PHP wasn't loading any php.ini file. A sudo cp /etc/php.ini.default /etc/php.ini did the trick. First it was only loading php-mysqlnd, now php-mysql as well, and all is fine.

Hmm, I was wrong, this doesn't solve anything.

A: 

Try re-setting your user-pw on the MySQL-Server. This way the password should be stored in the new format.

However, your mysql-library shipped with Snow Leopard might be compiled without support for old passwords.

Even on a live-server it should be okay to create a new db-user, so can check with a new user-account if you don't want to change the existing one.

What I don't get is why it's working fine with MAMP when I only start MAMP's Apache, but I get this error with Snow Leopard's build in Apache. Is it because MAMP has some MySQL files locally? Do I still need to install MySQL locally when I try to connect to a remote server? Any clue as to how to fix this on my side without messing around with the server? Preferably Apache only — don't want to install anything I don't need.

MAMP has all the files stored on his own, in his own versions. You don't have to run a local MySQL-Server if you want to connect to a remote server. You just have to install the mysql-libraries for PHP.

ppuschmann
A: 

Hi Alec,

I ran into the same problem and now I'm stuck. What did you change in the php.ini to enable php-mysql?

Sorry, this didn't work at all, I was just looking in the wrong place.I guess php-mysqlnd needs to be disabled somehow, and php-mysql enabled. PHP says: "For compiling, simply use the --with-mysql[=DIR]" although I have no clue as to how at the moment... Not so "simply" at all :)
Alec
+1  A: 

Any luck with this? I'm having the same exact issue. I tried resetting the password using both pre 4.1 and post 4.1 authentication with no avail.

EDIT::

My mysql server had the use old passwords option set in the configuration file, so the result of PASSWORD() and OLD_PASSWORD() returned the same 16 digit hash.

I ran SELECT PASSWORD('mysecret') on a different mysql server that uses new passwords to get the hash, then ran SET PASSWORD FOR 'myuser'@'%' = '*THEHASHFROMTHESELECTSTATEMENT';.

hth

Paul
A: 

The solution provided by Paul worked! I can't upvote so for everyone who has this problem; use his approach!

Paul:

I ran SELECT PASSWORD('mysecret') on a different mysql server that uses new passwords to get the hash, then ran SET PASSWORD FOR 'myuser'@'%' = '*THEHASHFROMTHESELECTSTATEMENT';.

Unfortunately this involves changing the passwords on the server. I was hoping for a solution that wouldn't involve changing any of that.
Alec