• I have read many of the posts for this problem and am still left unable to connect. ALL I am doing is moving an existing WordPress site from an Ubuntu 6.06 LAMP server to an Ubuntu 8.10 LAMP server.

    I can connect to the MySQL DB using the same connection info from wp-config.php in a test php file:

    <?php
    $db = @mysql_connect('localhost', 'dbname', 'dbpassword');
    if (!$db) echo "connection failed";
    else echo "connection succeeded";
    ?>

    results with “connection succeed”

    I have attempted replacing ‘localhost’ in wp-config.php with the server’s dedicated IP as well as 127.0.0.1

    I can log directly into MySQL via console using the credentials in the connection string.

    But the only thing that will solve the problem I can find so far is if I don’t change servers! *sigh*.

    The original WordPress site was running PHP5 and MySQL 5.0.22
    The new server is running PHP5 and MySQL 5.0.67

    Any other ideas as to what I am missing here??

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • I had a similar problem but I got it solved, but first thank you for helping me. I used your program to check my connection and it turned out I was not connected. I edited the bind address in /etc/mysql/my.cnf to my ip number and then I at least got connection. Still the same message though on wordpress set up.
    Then I tried:
    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON database1.* TO ‘yourusername’@’localhost’ IDENTIFIED BY ‘yourpassword’;

    and presto, it worked like a charm. I hope that solves your problem as well, but one never knows.
    Good luck
    Edwin

    Thread Starter kpm888

    (@kpm888)

    OMG!!! I am such an idiot. It was a bloody typo in my original grant options statement. An obvious one at that. But not one I noticed until reading Edwin’s response to my post (thank’s Edwin) re the grant option statement. I went to look again at permissions on the database and it jumped right out at me (a good night’s sleep really does do wonders). I checked over and over again the connection string but didn’t re-check the grant options close enough.

    Lesson learned. I’ll never type connection strings again. Cut and paste cut and paste cut and past…

    Anyway, I’m happy to now have climbed out of the rabbit hole this slip of the finger led me down.

    We have all been there (the rabbit hole) and we will be again in the future.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘“Error establishing a database connection” – it’s not a bad username or password’ is closed to new replies.