Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Apr 2005
    Posts
    55
    Thanks
    0
    Thanked 0 Times in 0 Posts

    connecting to mysql database

    Hi i'mhaving real trouble getting a connection to a mysql database i need to query. the connection script is below:

    <?php


    DEFINE ('DB_USER', "****");
    DEFINE ('DB_PASSWORD', "********");
    DEFINE ('DB_HOST',"localhost");
    DEFINE ('DB_NAME', "yorkshire");

    //connect to mysql

    $db_connection=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);

    //select the database

    mysql_select_db(DB_NAME);

    ?>

    the errors are:

    Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in C:\Server\Apache2\mysql_connect_york.inc on line 17

    Warning: mysql_select_db(): Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\Server\Apache2\mysql_connect_york.inc on line 21

    Warning: mysql_select_db(): A link to the server could not be established in C:\Server\Apache2\mysql_connect_york.inc on line 21

    I'm totally baffled, any ideas?

    cheers
    Steve

  • #2
    Regular Coder
    Join Date
    Feb 2005
    Location
    Texas
    Posts
    472
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I just do

    PHP Code:
    mysql_connect();
    mysql_select_db("yorkshire"); 
    If you're reading this, it may already be too late!

  • #3
    New Coder
    Join Date
    Apr 2005
    Posts
    55
    Thanks
    0
    Thanked 0 Times in 0 Posts
    would that be in the php script you are using to query? If so you won't need a seperate connecting script?

    steve

  • #4
    Regular Coder
    Join Date
    Feb 2005
    Location
    Tokyo, Japan
    Posts
    151
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Not sure if this will help, but this is what I do to get a connection...

    PHP Code:
    <?php

    //variables
    $db_host "localhost";
    $db_user "XXXXXX";
    $db_pass "XXXXXX";
    $db_name "yakisoba";
    $db_table "noodle";

    //connect to mysql
    mysql_connect($db_host$db_user$db_pass) or die ("Connection to mySQL failed");

    //select the database using $db_name
    @mysql_select_db("$db_name") or die ("Unable to locate: $db_name");

    ?>
    its pretty similar to what you did but without the DEFINE.

    Also, might be a good idea to make sure your php.ini is set up right ([MySQL] section)...I got screwed once not paying attention to php.ini settings.

    Yak

  • #5
    New Coder
    Join Date
    Apr 2005
    Posts
    55
    Thanks
    0
    Thanked 0 Times in 0 Posts
    cheers for that, got rid of two of the errors, but still leaving the nasty one,
    ie
    Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in C:\Server\Apache2\mysql_connect_york.inc on line 17
    Connection to mySQL failed

    line 17 is:
    mysql_connect($db_host, $db_user, $db_pass) or die ("Connection to mySQL failed");

    I'm starting to think it is the php.ini file although i've looked at this and can't see anything wrong....ideas??
    steve

  • #6
    Regular Coder
    Join Date
    Feb 2005
    Location
    Tokyo, Japan
    Posts
    151
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You're right, that is nasty...I never seen that one before.

    Personally I don't know the solution to that error, but I was able to find somthing that might help.

    Check this out:
    http://forums.mysql.com/read.php?11,...0611#msg-10611

    not sure but this may help you as well...
    http://dev.mysql.com/doc/mysql/en/old-client.html

    Yak
    Last edited by Yakisoba; 06-22-2005 at 11:34 AM.

  • #7
    New Coder
    Join Date
    Apr 2005
    Posts
    55
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for all your help yakisoba, I've already been through the first link,but it didn't work. i'll go through the second link. thanks for all your help with this, if anyone else has any ideas i'm all ears!!!
    cheers
    steve

  • #8
    New Coder
    Join Date
    Apr 2005
    Posts
    55
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thank You!!

    Thanks a lot for that last link, it worked a treat!
    thanks to everyone for their help it really is appreciated!
    steve


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •