/var/log/step2k

November 25, 2005

PHP with MySQL 4.1 and later

Filed under: MySQL, PHP - Salman Teguh @ 6:10 am

http://id2.php.net/function.mysql-connect
Anthony Boyd
27-Jul-2005 05:53
Some versions of PHP do not support the new longer passwords used by MySQL 4.1 and later. This will cause the error message that 2raptor mentioned a few posts prior to this one:

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

However, for ease of use, let’s review the two fixes right here.

First, you should upgrade to a newer PHP that supports the longer MySQL passwords. However, I don’t even know if the PHP 4.x series has been upgraded to handle this yet. So for my installation, I took a different approach — I downgraded MySQL’s passwords to the “old” shorter encryption. Here’s how:

SET PASSWORD FOR ’some_user’@’some_host’ = OLD_PASSWORD(’newpwd’);

As a real-world example, I used this query:

SET PASSWORD FOR ‘testaccount’@'%’ = OLD_PASSWORD(’secret’);

Suddenly, PHP could use the testaccount to access the database. Yay.

-Tony

1 Comment »

The URI to TrackBack this entry is: http://step2k.blogsome.com/2005/11/25/php-with-mysql-41-and-later/trackback/

  1. Thanks for your explanation. It’s really useful for me C0z I often face this situation.

    Again, thanks.

    Comment by DJ SGG — May 10, 2006 @ 7:45 am

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>


Get free blog up and running in minutes with Blogsome
Theme designed by Alex King