WordPress.org

Ready to get started?Download WordPress

Forums

Error establishing a database connection (11 posts)

  1. elizabeth.shell
    Member
    Posted 7 months ago #

    I know this topic has come up a bazillion times but I'm quite ready to pull my hair out after trying every recommended fix I can find.

    I'm using MAMP, BlueHost and Chrome. I've downloaded WP 3.8 and put in MAMP-->htdocs-->wordpress. I created a database called "wordpress' in phpMyAdmin in MAMP. I gave it all access and do not have a password on it (that I am aware of).

    Running http://localhost:8888/wordpress/ I am able to login and get the lovely HELLO WORLD! post / dashboard.

    Trying to go access http://elizabethshell.com/wp-admin/install.php results in the Error establishing a database connection. What am I doing wrong? Full config.php file is below, minus the password and config keys. As to the error screen's questions:

    Are you sure you have the correct username and password? -- Yes. I have also reset the password via the priveledges tab under PHPMyAdmin in MAMP. I used the generated password to update wp-config.php and re-ftp'ed it. No change in error message after refreshing the page. It also destroyed my localhost access so I changed it back to 'root.'

    Are you sure that you have typed the correct hostname? Yes. I am using BlueHost and triple-confirmed the hostname is localhost.

    Are you sure that the database server is running? Yes. My original index.html page is still up and running.

    I also tried doing the WP install via BlueHost, but received an error page saying they couldn't go further with a giant broken image that should have been a screenshot of the problem.

    wp-config.php
    /** The name of the database for WordPress */
    define('DB_NAME', 'wordpress');

    /** MySQL database username */
    define('DB_USER', 'root');

    /** MySQL database password */
    define('DB_PASSWORD', 'password-generated-from-phpMyAdmin');

    /** MySQL hostname */
    define('DB_HOST', 'localhost');

    /** Database Charset to use in creating database tables. */
    define('DB_CHARSET', 'utf8');

    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');

  2. ClaytonJames
    Member
    Posted 7 months ago #

    Just a little clarification that might help sort it out...

    Your localhost installation on your mac has nothing to do with the installation at elizabethshell.com on BlueHost.

    The information in wp-config.php for elizabethshell.com must exactly match the database name and user credentials that were set up for the database on the elizabethshell.com site, not the local installation on your Mac. The two are not related, and share no data between them.

    You've also installed WordPress in your root directory ( at elizabethshell.com ) with a pre-existing html site. You can't serve index.html and index.php from the same directory.

  3. elizabeth.shell
    Member
    Posted 7 months ago #

    Thanks ClaytonJames -- I deleted the index.html page so that there is only the .php version. No luck -- same database connection error. I'm positive the info on wp-config.php matches the information I used to set up the database on mysql via MAMP. Is there something else it could be?

  4. Senff
    Member
    Posted 7 months ago #

    I'm positive the info on wp-config.php matches the information I used to set up the database on mysql via MAMP.

    What you set up on MAMP (which is on your computer) has nothing to do with what you set up ElizabethShell.com (which is on your website). Did you set up a database on ElizabethShell.com? Not with MAMP but (probably) through a control panel on your web site?

    The wp-config.php that you upload to your website should contain the information on the database on your website -- not the database you created on your local computer.

  5. Sarathlal N
    Member
    Posted 7 months ago #

    elizabeth,
    Just leave your MAMP at your computer. It is localhost on your computer.
    The MAMP and its database are for WordPress installation on our computer.

    For your Bluehost hosting,

    1. First create a new database (with database name, user name & password) by using CPanel or PHPMYADMIN via bluehost administration panel.
    2. Then change wp-config.php with your new database name, new username, new password generated via Bluehost administration panel. Hostname may be localhost.

  6. elizabeth.shell
    Member
    Posted 7 months ago #

    @sarathlal N, @Senff -- thanks:

    So I deleted all existing databases on my CPanel via BlueHost. I created a new one and replaced the db name, password, and user name with the new credentials I created on the CPanel into wp-config.php and I still am getting the "Error establishing a database connection" problem. :(

  7. elizabeth.shell
    Member
    Posted 7 months ago #

    *Should note these were MySQL Databases.

  8. Sarathlal N
    Member
    Posted 7 months ago #

    Are you doing a fresh installation?
    If so, Upload wordpress downloaded folder ( zip format) via cPanel, then unzip that folder.
    Copy the files & folders from that unzipped folder and move them in to your installation diorectory.
    Then navigate to your domain or http://http://www.yourdomain.com/wp-admin/install.php via browser, you can get wordpress installation screen.

    There is some simple steps & you can enter your DB details at there.
    Enter your correct DB name, username, password at there. If error is happening, you entered wrong details.

    If still you have doubts, read the below article.
    [link removed - that vendor is not GPL compliant - sorry not a good link to post here]

  9. Senff
    Member
    Posted 7 months ago #

    I'm not familiar with Bluehost but sometimes the value for the hostname shouldn't be 'localhost' but something more structural (even when the DB is on the same server), like 3476767.mysite.com or whatever.

    If you're ABSOLUTELY sure that the info in wp-config.php that you uploaded to your server is correct and matches the database/user/password you created through cPanel, then perhaps you should contact Bluehost about this.

  10. WPyogi
    Volunteer Moderator
    Posted 7 months ago #

    Is there a reason you aren't using BlueHost's one-click install for WP?

  11. elizabeth.shell
    Member
    Posted 7 months ago #

    I'd tried using BlueHost's one-click install previously, but got an error message saying it couldn't install, along with a broken screenshot (so I couldn't see what the issue was). I tried BlueHost again last night, and that seemed to work after deleting the original index.html. I still cannot for the life of me figure out why the original installation would not work. BlueHost uses 'localhost' and I was indeed 1000% certain the info in wp-config.php was correct. Perhaps the next time I have to do this it will work out better.

    Thanks for the advice, everyone.

Reply

You must log in to post.

About this Topic