• Resolved shanepike

    (@shanepike)


    I’m getting the “Error establishing a database connection” error in Step 6 of “The Famous 5-Minute Install.” I do have a database set up called “wordpress” and I can connect to it just fine via ODBC and run whatever queries I need to. So, I know the connect info (database name, username, pwd, etc.) is all fine, and it matches exactly what’s in the wp-config.php file. Also, I can see the changes reflected on the error page when I make changes to wp-config.php, so I know it’s reading the correct file.

    What I suspect may be the problem is that we’re running two versions of mySQL on the server. One is version 4.something for Plesk, and I installed 5.0 this morning. 5.0 runs under a separate service name and on port 3309 (instead of the default 3306, which Plesk’s 4.something is running on), and as mentioned above I can connect to it just fine via ODBC.

    I am specifying the port in the DB_HOST connect string:
    define(‘DB_HOST’, ‘localhost:3309’);

    Any ideas why WP can’t connect to the database?

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter shanepike

    (@shanepike)

    Alright, I installed the files on a brand new domain on the same server (just in case putting it into an established domain was causing issues somehow), but I still have the same issues. It’s especially frustrating since I know the DB’s up and running just fine so it has to be (ostensibly) that WP just has a quirk in how it’s trying to talk to it, but I have no idea where to begin.

    I’m not sure, but did you give the username for that database FULL permissions for “ALL” and you also might want to contact the host for help.. :/

    Cause from what you said, everything was setup just fine and should be working. <knock on wood> I never had any problems with connecting to the database, unless it was an error on my end. Like: mis-spelling of username, password and ect..maybe try asking the host about this issue.. =)

    I dunno, because I never used anything other then just: localhost for the host field, but maybe the way you wrote that isn’t quite right or something.. again I’m not sure because I never used anything but just “localhost” for it…mmm..

    spencerp

    Thread Starter shanepike

    (@shanepike)

    Alright, I modified wp-db.php so it would actually return the error that it was getting. Now we’re getting somewhere. This is the actual error that it’s throwing when it tries to connect to the database:

    Client does not support authentication protocol requested by server; consider upgrading MySQL client

    Looking now to see how I can change the “authentication protocol requested by [the] server”…

    Thread Starter shanepike

    (@shanepike)

    Got it! We evidently have an old version of PHP on the server. Here’s what was causing the problem and how I fixed it: https://dev.mysql.com/doc/refman/5.0/en/old-client.html

    Great! Now, can you please mark this as resolved so that others will know there might be an answer in here.

    -tg

    Awesome shanepike! =) As TechGnome said, can you change the status of this post to resolved, so that others that might need this very same info can use it or read this post..? To change it’s status is at top of the post….

    spencerp

    Thread Starter shanepike

    (@shanepike)

    Done! Not sure if displaying the DB connection error message was one of the fixes in the just-released 2.0.1, but it would be a good addition.

    Hi shanepike!

    Can you tell me how to modify wp-db.php so it would actually return the error that it was getting?

    I’m getting a problem that’s very close to what you mentioned, but I want to see if it’s the same issue…

    I’m using: Apache/2.0.52 (Win32) PHP/4.3.9 and MYSQL Server 4.1

    tks!

    I was hoping for a reply to dadio’s post above but finally I tinkered enough to figure it out for myself. I’m not sure of the proper way to reference another post, but if you search for:

    Error Establish a databese connection
    by “nelsonov” (that’s me)

    You’ll find in the 2nd post how I hacked wp-db.php to give the actual error during the database connect. Noticed that I goofed and spelled my post with “Establish” instead of “Establishing”. That might make it easier to find.

    Good luck.

    Thanks,

    It solved my issue….

    Thank God! Glad to hear it. =) Now, still on with the rest I guess… sigh.. :/

    spencerp

    Ok, my problem was the same as shanepike. This has nothing to do with WordPress!!

    It’s just a PHP and MYSQL incompatibility issue.

    Tks to all for the info.

    dadio.

    I have a related issue (I think), but my php, mysql and mysql client are all up to date.

    All worked fine until I changed over to mysql 4.1.14 (not the standard OSX install that was running when I installed WP) and now the WordPress PHP scripts can’t find mysql:
    “Error establishing a database connection, etc.”

    Short story: mySQL is running, database is ok, but I think PHP is looking for the old instance of mySQL which is not running, and I don’t know how to redirect it.

    Details:
    mysql 4.1.14, php 4.3.11, apache and wp1.5.1.3 on OSX 10.4.4, with a static IP.

    wp-config.php has correct login and password (nothing’s changed)
    mysql is running — I can connect from command line and MySQL Administrator
    ps shows: /usr/local/mysql/bin/mysql is running
    this is the new version I installed

    phpinfo() shows: support is enabled for /var/mysql/mysql.sock
    but MySQL Administrator says the instance of mysql actually running uses /tmp/mysql.sock
    phpinfo() shows: Client API version 4.1.13a
    but MySQL Admin says MySQL Client Version 5.0.4

    So I think PHP is looking for the old instance of mySQL.

    I edited /etc/php.ini: mysql.default_socket = /tmp/mysql.sock — no luck

    I reset the password manually – probably not necessary:
    set password for ‘wpuser’@’localhost’=OLD_PASSWORD(‘xxxxxxxx’); — nope

    I tried setting define(‘DB_HOST’, ‘my.host.com’); — No luck

    Added “Error: $my_errstr;” to the code in wp-db.php but it doesn’t report anything.

    I flushed the browser cache each time.

    Running out of ideas.
    Thanks in advance for your time.

    Solved – somehow the user’s privileges had been removed. I restored them and all’s well.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Error establishing a database connection’ is closed to new replies.