For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > November 2004 > mysql_connect failed in apache 5.0.22









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author mysql_connect failed in apache 5.0.22
Allen Guan

2004-11-22, 3:55 pm

Hello all,

I am running MYSQL 4.1.17, PHP 4.3.9 under apache 2.0.52 on solaris.
PHP seems to work fine, except that it can't connect to mysql
database. I got this error:

Warning: mysql_connect(): Client does not support authentication
protocol requested by server; consider upgrading MySQL client


But MYSQL 4.1.17 is the latest version, and PHP 4.3.9 is the latest 4
version. Should I try PHP 5.0.2 or downgrade apache?

Please help.

Allen Guan
Tim Van Wassenhove

2004-11-22, 3:55 pm

In article <883aa369.0411220836.6f523b83@posting.google.com>, Allen Guan wrote:
> Hello all,
>
> I am running MYSQL 4.1.17, PHP 4.3.9 under apache 2.0.52 on solaris.
> PHP seems to work fine, except that it can't connect to mysql
> database. I got this error:
>
> Warning: mysql_connect(): Client does not support authentication
> protocol requested by server; consider upgrading MySQL client


You should use mysqli_connect

--
Met vriendelijke groeten,
Tim Van Wassenhove <http://www.timvw.info>
Anonymous

2004-11-22, 8:56 pm

Allen Guan wrote:
>
> Hello all,
>
> I am running MYSQL 4.1.17, PHP 4.3.9 under apache 2.0.52 on solaris.

^^^^^^
That is the reason for the error.

> Warning: mysql_connect(): Client does not support authentication
> protocol requested by server; consider upgrading MySQL client


MySQL 4.x use a newer authentication, more secure authentication method
with longer passwords. Since PHP does not yet understand this method a
connect will always fail with that error message.

> But MYSQL 4.1.17 is the latest version, and PHP 4.3.9 is the latest 4
> version. Should I try PHP 5.0.2 or downgrade apache?


Neither is neccessary. You can tell MySQL to fall back to old style
authentication until PHP is upgraded to support the new method.

Shutdown the MySQL server, look for the MySQL config file (It's usually
called my.ini and can be found in the directory where you installed the
server. At least that's where I can find it in the Windows version.). In
the config file look for the "[mysqld]" section and write one line with
the content "old-passwords" (without the quotes of course) into the
file. Save the file and restart the server.

If you followed these instructions to the letter MySQL will now accept
calls from PHP again.

Bye!
Anonymous

2004-11-22, 8:56 pm

Tim Van Wassenhove wrote:
>
> In article <883aa369.0411220836.6f523b83@posting.google.com>, Allen Guan wrote:
>
> You should use mysqli_connect


There is no mysqli_connect() in PHP4.

Bye!
Anonymous

2004-11-22, 8:56 pm

Anonymous wrote:

Correcting myself:

> MySQL 4.x use a newer authentication, more secure authentication method


MySQL 4.1.x uses a newer, more secure authentication method...
Brion Vibber

2004-11-22, 8:56 pm

Allen Guan wrote:
> Warning: mysql_connect(): Client does not support authentication
> protocol requested by server; consider upgrading MySQL client
>
> But MYSQL 4.1.17 is the latest version, and PHP 4.3.9 is the latest 4
> version. Should I try PHP 5.0.2 or downgrade apache?


Both PHP 4.3.9 and PHP 5.0.2 will have this problem because you're using
the old MySQL client libraries.

Either recompile PHP explicitly using the updated MySQL 4.1 client
libraries, or fiddle with MySQL to use the old, compatible
authentication scheme.

Please see: http://dev.mysql.com/doc/mysql/en/Old_client.html

-- brion vibber (brion @ pobox.com)
Allen Guan

2004-11-23, 3:56 pm

Brion Vibber <brion@pobox.com> wrote in message news:<30f51uF2vvdqhU1@uni-berlin.de>...
> Allen Guan wrote:
>
> Both PHP 4.3.9 and PHP 5.0.2 will have this problem because you're using
> the old MySQL client libraries.
>
> Either recompile PHP explicitly using the updated MySQL 4.1 client
> libraries, or fiddle with MySQL to use the old, compatible
> authentication scheme.
>
> Please see: http://dev.mysql.com/doc/mysql/en/Old_client.html
>
> -- brion vibber (brion @ pobox.com)


Thanks a bunch. After I use "set password for 'user'@'localhost' =
OLD_PASSWORD(newpwd, it works.

Allen Guan
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com