• I have had the same problem twice now inside 1 month.
    Randomly I get the “Error establishing Database connection” message.
    And when I go to my WP backend, I have the option to click “repair the database” button that fixes the problem.

    On the Database Repair page it still says:

    Some database problems could not be repaired…
    wp_users: 4 clients are using or haven’t closed the table properly
    wp_usermeta: 4 clients are using or haven’t closed the table properly
    wp_posts: 4 clients are using or haven’t closed the table properly
    wp_comments: 4 clients are using or haven’t closed the table properly
    wp_options: Table is marked as crashed
    wp_postmeta: 4 clients are using or haven’t closed the table properly
    wp_terms: 4 clients are using or haven’t closed the table properly
    wp_term_taxonomy: 4 clients are using or haven’t closed the table properly
    wp_term_relationships: 4 clients are using or haven’t closed the table properly
    wp_commentmeta: 4 clients are using or haven’t closed the table properly

    Is there something I can do to fix these problems??
    My WordPress is working fine now but I am sure that eventually I will get that “Error Establishing Database connection” message again.

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

    (@t-p)

    Error connecting to your database is common, but it isn’t necessarily a problem with wordpress itself.
    – 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 hosting provider if the database server is online / if they have any other problem at their end, or they made any changes to your account, or if there are any limitations/restrictions, if the hosting package is set to Windows and not Linux, etc.
    – There are also many threads on this topic on these forums: https://www.ads-software.com/search/Error+establishing+a+database+connection?forums=1

    Thread Starter Stephen B

    (@wordpmoon12)

    Thanks,

    But in my case the errors are in the database.
    So my database is connected and the website works fine but I had some errors after repairing the database:

    See the screenshot here:
    screenshot repair database

    Moderator t-p

    (@t-p)

    Try reviewing:

    https://codex.www.ads-software.com/FAQ_Troubleshooting#How_do_you_repair_a_MySQL_database_table.3F

    Once you have repaired the database, if the issue still persists, Try:

    -deactivating ALL plugins temporarily to see if this resolves the problem. If this works, re-activate them individually (one-by-one) to find the problematic plugin(s). If you can’t get into your admin dashboard, try deactivating via FTP or SFTP or whatever file management application your host provides. If applicible, also remember to deactivate any plugins in the mu-plugins folder. The easiest way is to rename that folder to mu-plugins-old.
    – To rule out any theme-specific issue, try switching to the unedited default theme for a moment using the WP dashboard. If you don’t have access to your admin area, you can switch to the default theme by renaming your current theme’s folder in wp-content/themes and adding “-old” to the end of the folder name using via FTP or SFTP or whatever file management application your host provides. Alternately, you can remove other themes except the default theme. That will force your site to use it.
    resetting the plugins folder by FTP or PhpMyAdmin. Sometimes, an apparently inactive plugin can still cause problems (because the hooks remain unless plugins completely removed or some plugins stick around in cached files. So by renaming the folder, you break them and force them inactive).

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WordPress Database error and repair’ is closed to new replies.