SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face trying to connect database no succeded!!! please help!!!

    i've been trying to solve this problem with no succes. i tryed the basics errors :
    -my password is correct
    -localhost
    -database name, also good.
    I really can`t reach to bottom, so please someone give me a hand!

    here`s the script

    // Connect to the database server
    $dbcnx = @mysql_connect('localhost', 'root', 'mypasswd');
    if (!$dbcnx) {
    exit('<p>Unable to connect to the ' .
    'database server at this time.</p>');
    }

    // Select the jokes database
    if (!@mysql_select_db('ijdb')) {
    exit('<p>Unable to locate the joke ' .
    'database at this time.</p>');
    }

    thank you!!!

    When all think alike, no one is thinking very much.

    ~Walter Lippmann

  2. #2
    SitePoint Evangelist catweasel's Avatar
    Join Date
    Apr 2007
    Location
    Goldfields, VIC, Australia
    Posts
    518
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    remove the @ signs in the code as they are suppressing warnings.

  3. #3
    SitePoint Zealot ozwebfx's Avatar
    Join Date
    Dec 2004
    Location
    Melbourne, Australia
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Double check that you have given permissions to the db user to access the db

  4. #4
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <?php
    mysql_connect("localhost", "root", "root") or die(mysql_error());
    echo "Connected to MySQL<br/>";
    mysql_select_db("test") or die(mysql_error());
    echo "Connected to Database";
    ?>
    and this send me this error message:
    Client does not support authentication protocol requested by server; consider upgrading MySQL client.

    Theres any easier way!!! Oh thank for the tips above.

    When all think alike, no one is thinking very much.

    ~Walter Lippmann

  5. #5
    SitePoint Evangelist catweasel's Avatar
    Join Date
    Apr 2007
    Location
    Goldfields, VIC, Australia
    Posts
    518
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by darnok View Post
    Client does not support authentication protocol requested by server; consider upgrading MySQL client.
    What version of mysql and what version of php are you using?

  6. #6
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking

    php version 4.3.1 and mysql 4.1.22

    When all think alike, no one is thinking very much.

    ~Walter Lippmann

  7. #7
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the phpinfo() shows taht the client api version of mysql is 3.23.49, that have any meaning? since i installed version 4.1.22

    When all think alike, no one is thinking very much.

    ~Walter Lippmann

  8. #8
    SitePoint Evangelist catweasel's Avatar
    Join Date
    Apr 2007
    Location
    Goldfields, VIC, Australia
    Posts
    518
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by darnok View Post
    the phpinfo() shows taht the client api version of mysql is 3.23.49, that have any meaning? since i installed version 4.1.22
    Your mysql version is 4.1 but your mysql client version is 3.2 .. 4.1 uses a different password type for the mysql user table so if you want to continue using the old client you need to set the passwords for users in the old type..

    at the terminal shell enter the mysql client by typing mysql and then type this-
    Code:
    SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('yourpassword');

  9. #9
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it works!!!!!
    thank you a lot!!!!!

    When all think alike, no one is thinking very much.

    ~Walter Lippmann


Bookmarks

Posting Permissions

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