Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a mySQL / PHP setup that I've used on several systems. I just recently upgraded my system to Max OSX 10.6, and now it cannot connect. I get the error:

mysqlnd cannot connect to MySQL 4.1+ using old authentication

I've done the obvious google searches, but most of them seem to be all about how to get mysql to use the old password style, which seems like it will no longer work. In any case, I want to find a better solution that allows me to use the newer password style.

I create my password with:

mysql> UPDATE mysql.user SET Password=PASSWORD('mypassword') WHERE User='root';

(or OLD_PASSWORD, it doesn't seem to matter)

and I log into the database with:


where $username is root and $password="mypassword"

What is the CORRECT solution to this problem, as forcing it keep using the old password technology is clearly NOT the right solution...


ps if this belongs on stackoverflow or superuser, let me know...

share|improve this question

D'oh, I'm an idiot. when I manually re-set the root password using PASSWORD("password") I didn't re-set the USERS password the same way, so the users password was still OLD_PASSWORD("password"), and our PHP is logging in as user, not as root (which I suppose is a good thing.)

I manually re-set the users password with PASWORD("password") and everything seems to work...

share|improve this answer
I find it somewhat disconcerting that an answer starting with "D'oh I'm an idiot" has gotten two upvotes... and you guys don't even know me! hehe. – Brian Postow Nov 4 '09 at 16:03

When you reset the password are you running mysql in safe mode? I know sometimes mysql is very finnicky about resetting root's password. Try this post if you haven't already... how to forge

share|improve this answer
Yes, I am running mysql in safe mode is that a problem?when I re-set the root password, it DOES change it. I think that the problem is with the PHP mysql_connect call maybe? – Brian Postow Nov 3 '09 at 21:50
No the mysql_connect is the correct syntax and you have supplied the correct parameters. Though you might try just: mysql_connect('localhost', 'user', 'password'); so in effect you, instead of giving the variables you are giving the string literals. Just as a test. – lilott8 Nov 3 '09 at 22:19

Try enabling old_passwords = true in my.cnf. Should help ;)

share|improve this answer
that defeats the purpose. I want to use new passwords! – Brian Postow Nov 3 '09 at 22:49

After manually playing with theses tables make sure to execute FLUSH PRIVILEGES so MySQL reads the new values.

In general it is better to use SET PASSWORD to change the password as this verifies the table values are valid. With the manual way you easily get invalid data into the user tables.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.