problem connecting to mysql database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jasongr
Forum Contributor
Posts: 206
Joined: Tue Jul 27, 2004 6:19 am

problem connecting to mysql database

Post by jasongr »

Hello

I am trying to connect to a remote mysql database using an account which I created
When I use the following command from the shell:

Code: Select all

mysql -h host -u user -p
I connect successfully everytime

However, when I try to connect to the mysql server from PHP using
mysql_connect(host, user, password)
I keep failing.

Is there a way to determine what caused the problem?
is there some entry in a log file which I can refer to?

regards
jasongr
Forum Contributor
Posts: 206
Joined: Tue Jul 27, 2004 6:19 am

Post by jasongr »

I investigated further and found out that the I am getting the following error message:

Code: Select all

Client does not support authentication protocol requested by server; consider upgrading MySQL client
According the the MySQL manual:

Code: Select all

MySQL 5.0 uses an authentication protocol based on a password hashing algorithm that is incompatible with that used by older (pre-4.1) clients. If you upgrade the server from 4.1, attempts to connect to it with an older client may fail with the following message: 
shell> mysql
Client does not support authentication protocol requested
by server; consider upgrading MySQL client
Note that I am connecting successfully from the shell command

The only problem I am having is connecting to the mysql server from my php application

any help would be appreciated
jasongr
Forum Contributor
Posts: 206
Joined: Tue Jul 27, 2004 6:19 am

Post by jasongr »

I just managed to solve the problem
I went to phpmyadmin (which I used to create the user), and used

Code: Select all

SET PASSWORD FOR user@localhost = OLD_PASSWORD('password');
That seemed to have solved the problem
I am guessing that the client that phpmyadmin was using was an older one
Post Reply