Simmons Consulting, the Website of Toby Simmons

Connecting PHP 4 to MySQL 5

20
Aug

I recently upgraded one of our MySQL servers from 4.1.22 to 5.1.26. In the process of upgrading, I dumped all the databases, uninstalled MySQL then installed a clean copy of 5.1.26. Then I manually created all the users and schemas by hand, then restored our backups to the new install. Everything went smoothly and all the servers that had PHP 5.x installed could connect with no problems (because they used the latest version of the MySQL client API.)

But some of our older servers still had PHP 4.4.7 installed. When any of their applications tried to connect to the new MySQL server, they would error out with the message:

Client does not support authentication protocol requested by server; consider upgrading MySQL client.

phpinfo() reported the MySQL client API version to be 3.23.49. Since it takes MySQL client version 4.1 or higher to connect to a MySQL 5 server with native authentication, I spent about an hour trying to figure out how to update just the MySQL client API on the older PHP server (I didn’t want to try to update the PHP yet because of several other things that might break.)

Then it hit me: all I needed to do was update the one login that the older version of PHP used to connect. So after issuing the following comment:

  1. set password for 'username'@'%' = OLD_PASSWORD('password');

everything worked again!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>