• Resolved lottelodge

    (@lottelodge)


    I get this message when I fill in all my MySQL database info, and I tried changing it directly in the wp-config-sample.php file but it didn’t make any difference.

    This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at %. This could mean your host’s database server is down.

    Are you sure you have the correct username and password?
    Are you sure that you have typed the correct hostname?
    Are you sure that the database server is running?
    If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

    All I can think of is there’s something wrong at the MySQL host’s side of things, because I’m sure I’ve got all the info right, for example, the password. But I wanted to check here and tap into the wisdom of the more experienced, just in case, because I am new and don’t have any wordpress experience at all!

    One question I do have is: in the Database Name field when setting up (wp-admin/setup-config.php?step=1), should I have .db on the end or not?

    Lotte

Viewing 12 replies - 1 through 12 (of 12 total)
  • Moderator t-p

    (@t-p)

    -First, double check your wp-config.php file settings for the database name, database username and database password. This is where most errors occur.

    -Then check that you don’t need to change the database host from “localhost” to something else. You can get that info from your hosting provider.

    -Check you have actually created a database with the same database name as is in your wp-config.php file.

    -Last, but not least, if all that information is correct your database probably has a problem with it and you may need to contact your web hosting.

    There are also many threads on this topic on these forums: http://wordpress.org/search/Error+establishing+a+database+connection?forums=1

    Thread Starter lottelodge

    (@lottelodge)

    Okay, I think I’ve covered all of those, so I suspect I need to contact the host. :/ Thank you, I will keep you posted.

    Lotte, often times hosts require you to use a special username. It’s a combination of your account name and a database name. If you can log into your control panel, the tab with your databases on it should have these details.

    Chris

    Thread Starter lottelodge

    (@lottelodge)

    Hmmm, I think I know the one you mean. For my main site, I was given a new username that was a bit like username_domainname, but I just tried that and got nothing. :/

    Your support team should be able to help you out but in the mean time, take a look in your control panel, what you should see are some names like:

    yourftplogin_adatabasename – that’s the database name
    yourftplogin_dbusername – that’s the username

    What these are, always depends on your host but you’ll also want to double check that you’re using localhost for the location. Some hosts require you to input the actual path such as mysql1.hostname.com.

    Chris

    Thread Starter lottelodge

    (@lottelodge)

    I’m with nearlyfreespeech.net, who for some reason say that I should never use localhost, only %. Voila the info from the FAQs: https://members.nearlyfreespeech.net/lottelodge/support/faq?q=DSN#DSN

    The DSN, or hostname, for connecting to MySQL is the name you gave when you created it, followed by the extension .db. The full connection information can be found in the email sent to you when you created your database. Never use localhost as part of your database connection information.

    And this: https://members.nearlyfreespeech.net/lottelodge/support/faq?q=MySQLUserHost#MySQLUserHost

    The MySQL “user” table that controls who can access your MySQL process contains a “Host” field that controls what hosts can connect as that user. No matter how you create MySQL users, when using our service, you should always use make sure the “Host” field winds up containing only the % character.

    Since we use a clustered network with specialized nodes for hosting and specialized nodes for MySQL, you will never connect to your MySQL process from the server it’s actually running on. Since things move around, you won’t even know in advance which server will originate the connection. Using the % character allows connections from any of the servers on our network, which is the only way you will be able to connect. Using “localhost” or any other value will lead to connection problems.

    Moderator t-p

    (@t-p)

    @lottelodge,

    Is the issue resolved?

    Thread Starter lottelodge

    (@lottelodge)

    Sadly not. :/ I’ve posted something in the forums over at NearlyFreeSpeech.net, but I’m too tired to keep working on it right now. Later this evening, perhaps? Anyway, A few people here and over at NFSN have made suggestions, and I’ve learned that the DSN doesn’t need .db on the end, and I’ve tried editing the wp_config.php file, but it’s still not working.

    I am open to any and all suggestions!

    Thread Starter lottelodge

    (@lottelodge)

    Success! I’d missed a step in creating the database. Bless the Error page for assuming I’d done everything right so far!

    For the future reference of people trying to set up a WordPress thing on NearlyFreeSpeech.net, I used this handy tutorial: http://dantoday.blogspot.com/2009/06/how-to-install-wordpress-blog-on.html

    Thank you both for your efforts. 🙂

    Moderator t-p

    (@t-p)

    Glad you got it working. 🙂

    Please mark this thread “resolved” using the dropdown in the right panel.

    Thread Starter lottelodge

    (@lottelodge)

    Aha, thanks for that. Will do. 🙂

    Moderator t-p

    (@t-p)

    You are welcome. 🙂

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

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