• I have installed WordPress a few times now, as I’ve realized things I’ve done wrong and re-installed to fix them, so there may be some old cruft floating around but I don’t think so.

    My environment:
    Windows 2008
    IIS 7.5
    php 5.3.3
    MySQL 5.1.49

    I used WPI to install WordPress, following the instructions here:
    http://codex.ww.wp.xz.cn/Installing_WordPress#Easy_5_Minute_Wordpress_Installation_on_Windows

    Everything goes well until the very end when I am supposed to click the “launch” link. My browser opens to index.php but I get an error saying “Error establishing a database connection”

    wp-config.php:
    // ** MySQL settings – You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define(‘DB_NAME’, ‘news’);

    /** MySQL database username */
    define(‘DB_USER’, ‘newsadmin’);

    /** MySQL database password */
    define(‘DB_PASSWORD’, ‘secret’);

    /** MySQL hostname */
    define(‘DB_HOST’, ‘localhost’);

    From the command line,
    mysql -h localhost -u newsadmin -p news
    Enter password: secret
    This works and I get logged in to mysql, however “show tables” shows that no tables have yet been created.

    phpmyadmin shows the ‘news’ database, but with no tables.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter ltward

    (@ltward)

    Forgot to mention – this is a dedicated installation, not a hosted solution.

    Thread Starter ltward

    (@ltward)

    Found two “newsadmin” users in the mysql database; one was associated with “hostname” and the other with “localhost”.

    Deleted the one associated with “hostname”, no joy.
    Ensured the password was what I wanted by running the following mysql command:
    GRANT ALL PRIVILEGES ON news.* TO “newsadmin”@”localhost”
    -> IDENTIFIED BY “secret”;

    Still getting “Error establishing a database connection” from my browser, still able to access mysql with the credentials in wp-config.php

    Tried going to http://…/wp-admin/setup-config.php and got
    The file ‘wp-config.php’ already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try installing now.

    Clicked on “installing” and it took me to install.php which gave “Error connecting to database”.

    I have the same issue. Anybody solve this?

    Thread Starter ltward

    (@ltward)

    I have determined that the error is being thrown by
    function dead_db()
    in
    wp-includes/functions.php

    From what I can determine, dead_db() is only ever called from is_blog_installed(), also in functions.php

    dead_db() is getting called, but I never see a message about one or more database tables being unavailable.

    I also can’t figure out why that portion of the code is even getting executed at all; before re-installing I dropped the database completely. And now after re-installing, the database exists but it contains no tables.

    Thread Starter ltward

    (@ltward)

    So, in desperation, I uninstalled MySQL.
    I removed it via Control Panel, then via the installer, then I deleted all the files under c:\Program Files \MySQL.

    Then I re-installed MySQL, installed WordPress… and when I click “launch” I still get the “Error establishing a database connection”.

    Anyone got any ideas of what I could try next? I’m willing to do the work here, I’m just flat out of ideas.

    Thread Starter ltward

    (@ltward)

    I deleted WP and re-installed it using a new site name, MySQL database name, userid, and password.
    Still getting “Error establshing a database connection” when I click the launch link (it takes me to index.php and I get the error).

    I can login to MySQL using the credentials shown in wp-config.php
    I can use the database.
    When I show tables, there are none.

    Any ideas from anyone?

    Thread Starter ltward

    (@ltward)

    OH, how excited am I???

    In C:\windows\system32\drivers\etc\hosts, I had uncommented both the localhost lines:

    127.0.0.1     localhost
         ::1     localhost

    I re-commented the ipv6 line and left the ipv4 line uncommented:

    127.0.0.1     localhost
    #     ::1     localhost

    AND IT WORKS!!!!

    Thread Starter ltward

    (@ltward)

    Should probably mention, the reason I thought to mess with etc/hosts is because when I tried to ping localhost, instead of pinging 127.0.0.1 it was pinging my real IP and showing my FQHN.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Error establishing a database connection’ is closed to new replies.