1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Connecting to MySQL

Discussion in 'PHP' started by netaddict, Apr 2, 2005.

  1. #1
    In my php script, I have written the following to connect to the database:

    mysql_connect("localhost",$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");

    I am trying to use a HTML form to insert records into the database. But, I am getting the following error:

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

    I searched the net for this, I came across this page:
    http://dev.mysql.com/doc/mysql/en/old-client.html

    I tried the above things (but not sure, if I followed the instructions correctly) Still, I am not able to connect to the database.

    Can you please explain me what is happening? Thanks for helping in advance.

    Net Addict
     
    netaddict, Apr 2, 2005 IP
  2. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #2
    noppid, Apr 2, 2005 IP
  3. netaddict

    netaddict Peon

    Messages:
    640
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I don't think this is the problem. I think the problem is of different version of MySQL (and the way it interprets the password).

    Cauz on my other host, with an older version of MySQL, I am using same commands without any trouble.
     
    netaddict, Apr 2, 2005 IP
  4. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Although it's not a good practice, this is valid syntax (the last connection is used).

    I've seen this error when I upgraded my MySQL server to 4.1.x from an earlier version.

    J.D.
     
    J.D., Apr 2, 2005 IP
  5. netaddict

    netaddict Peon

    Messages:
    640
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #5
    So, any solution?
     
    netaddict, Apr 2, 2005 IP
  6. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I had this problem with my Win2K3 client and all I had to do is to download the latest ODBC driver. With PHP, I built all three (i.e. MySQL client/server and PHP) from the source and they all work together just fine. You can check the version of the server by running "select version();", but don't know how to check the version of the MySQL client built into PHP.

    J.D.
     
    J.D., Apr 2, 2005 IP