/    Sign up×
Community /Pin to ProfileBookmark

problem connecting to mysql database

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]
mysql -h host -u user -p
[/code]

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

to post a comment
PHP

8 Comments(s)

Copy linkTweet thisAlerts:
@jasongrauthorDec 18.2005 — I investigated further and found out that the I am getting the following error message:
<i>
</i>Client does not support authentication protocol requested by server; consider upgrading MySQL client

According the the MySQL manual:
<i>
</i>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&gt; 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
Copy linkTweet thisAlerts:
@NogDogDec 18.2005 — For debugging, make sure you don't have a '@' in front of the mysql_connect() so that you do not suppress error reporting (and make sure error_reporting has not been set to a level that suppresses all errors). Then you should at least find out if the problem is the hostname or user login, then we can go from there.
Copy linkTweet thisAlerts:
@jasongrauthorDec 18.2005 — Hi NogDog

I don't have '@' in front of mysql_connect and my error reporting level is:
[code=php]
error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);
[/code]

The only indication of the error that I am getting is:
<i>
</i>Client does not support authentication protocol requested by server; consider upgrading MySQL client

any suggestions?
Copy linkTweet thisAlerts:
@NogDogDec 18.2005 — What versions of PHP and MySQL are you using (and on what platform)?
Copy linkTweet thisAlerts:
@jasongrauthorDec 18.2005 — I am running PHP Version 5.0.1

The MySQL version is 5.0.15 and it is running on a Linux machine

I am running the PHP application on top of a Windows XP machine

Note that I was able to connect via the command shell from a Linux machine
Copy linkTweet thisAlerts:
@NogDogDec 18.2005 — Hmmm...so PHP is running on the WinXP machine? Any chance you're running MySQL 4 DLLs on that machine? If so, you may need to upgrade them to 5 to be compatible. Other than that, you've got me stumped. ?
Copy linkTweet thisAlerts:
@chazzyDec 18.2005 — 2 problems to consider:

  • - The MySQL client wasn't installed properly. Are you able to connect via tools like mysql administrator?

  • - Since the db server and php server are on different boxes, is skip networking turned on on the mysql server? This would fix it. that needs to be on to connect from a remote machine. your account may only have local access and you would need to give it wild card access "%"
  • Copy linkTweet thisAlerts:
    @jasongrauthorDec 18.2005 — I just managed to solve the problem

    I went to phpmyadmin (which I used to create the user), and used
    <i>
    </i>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
    ×

    Success!

    Help @jasongr spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.8,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...