WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Caught in endless database error loop (11 posts)

  1. nicknormal
    Member
    Posted 2 years ago #

    Overnight my database seems to have disconnected.

    Upon going to my /wp-admin/ area I am given the following error:

    One or more database tables are unavailable. The database may need to be repaired.

    I click 'repaired' and am given the options to 'Repair Database' or 'Repair Database and Optimize' - I click 'Repair Database' and then I get the following:

    To allow use of this page to automatically repair database problems, please add the following line to your wp-config.php file. Once this line is added to your config, reload this page.
    define('WP_ALLOW_REPAIR', true);

    I modify wp-config, re-upload, force refresh and I am given the following:

    Repairs complete. Please remove the following line from wp-config.php to prevent this page from being used by unauthorized users.
    define('WP_ALLOW_REPAIR', true);

    I remove the line, re-upload, ensuring there are now 'garbage' blank spaces or lines.

    Upon going back to /wp-admin/ I am confront with the original error:

    One or more database tables are unavailable. The database may need to be repaired.

    The whole process repeats.

    Please advise! And thank you in advance.

  2. keesiemeijer
    moderator
    Posted 2 years ago #

    Try to repair your database through phpmyadmin: http://codex.wordpress.org/FAQ_Troubleshooting#How_do_you_repair_a_MySQL_database_table.3F

    But make a database backup of what you have now first: http://codex.wordpress.org/Backing_Up_Your_Database

    Check if the database info is correct in wp-config.php.

    Ask your host if they have a backup of your database from before the problem first occurred.

  3. nicknormal
    Member
    Posted 2 years ago #

    hi keesiemeijer,

    I have made a backup of my database - in cPanel's MySQLDatabases tab it says my database is 506.64MB; when I export the database via phpMyAdmin the file is only 67.7MB - does this sound faulty or correct?

    I have tried 'checks' and 'repairs' of the database via phpMyAdmin and everything returns OK.

    I currently have a support ticket with my host; this was on a managed dedicated server, not shared, so I'm not sure where the corruption took place. Everything was fine last night. Any other ideas on where I might look?

    Thank you.

  4. keesiemeijer
    moderator
    Posted 2 years ago #

    when I export the database via phpMyAdmin the file is only 67.7MB - does this sound faulty or correct?

    Maybe it's a zipped file.

    Here is a topic with the same problems: http://wordpress.org/support/topic/error-establishing-a-database-connection-171?replies=20

    Some people got it working setting the home and site url to the correct value. maybe it helps if you set the home and site url to the correct values with one of these methods: http://codex.wordpress.org/Changing_The_Site_URL

    WP_HOME - the address you want people to type in their browser to reach your WordPress blog. It should include the http:// part and should not have a slash "/" at the end.

    WP_SITEURL - The value defined is the address where your WordPress core files reside. It should include the http:// part too. Do not put a slash "/" at the end.

  5. nicknormal
    Member
    Posted 2 years ago #

    The file is uncompressed.

    Thanks for the other topic's tip; I noticed sidarcy recommends the following:

    UPDATE YOUR DATABASE NAME.wp_options SET option_value = 'http://YOURURL' WHERE wp_options.option_id =2 LIMIT 1 ;

    I know what he is referring to, and I actually DO NOT have a site URL option_value in my wp_options table!! Could this somehow be the problem? In fact, I don't have anything with option_id=2 - it's unclear to me if I make a new option table if it MUST be id=2 or if any id number is okay, and the option_value is more important?

    I will avoid modifying the database until I hear back from the host, but it is good to know this might be something to troubleshoot.

    Thanks.

  6. nicknormal
    Member
    Posted 2 years ago #

    okay I found option_name=home and it was #39; but I do not see option_name=siteurl which I see according to the Changing the Site URL codex should be in the database. Do you recommend inserting this option_name and option_value and if so, do you recommend a process to do this correctly?

    THank you.

  7. keesiemeijer
    moderator
    Posted 2 years ago #

    but I do not see option_name=siteurl

    Did you look on page 2 or page 3 etc...

    Try setting the correct urls with the functions.php method if this is not a multisite website.

    Is this a multisite?

    I will avoid modifying the database until I hear back from the host, but it is good to know this might be something to troubleshoot.

    Yes, don't edit the database directly before you hear from your host.

    here are some more topics that might be useful to investigate: http://www.google.com/search?q=site:http://wordpress.org/support/+define%28%27WP_ALLOW_REPAIR%27,+true%29%3B

  8. nicknormal
    Member
    Posted 2 years ago #

    It is a single site; and I set phpMyAdmin to show all rows (598 total), so they're all visible on one screen, and I organized numerically by option_id by clicking that column (which is how I found 'home' at #39).

    I will edit and report back.

    Thank you for your advice keesiemeijer - I want a Thanksgiving without any server errors!!

  9. keesiemeijer
    moderator
    Posted 2 years ago #

    Other things that are safe to try:
    - switching to the default theme by renaming your current theme's folder in wp-content/themes using FTP or whatever file management application your host provides.

    - resetting the plugins folder by using FTP or whatever file management application your host provides. Sometimes, an apparently inactive plugin can still cause problems.

    - re-uploading all files & folders - except the wp-content folder from a fresh download of WordPress. by using FTP or whatever file management application your host provides.

    - renaming or deleting the .htaccess file by using FTP or whatever file management application your host provides. If you delete it make a backup first.

  10. nicknormal
    Member
    Posted 2 years ago #

    Thank you for all your help keesiemeijer.

    After some back and forth with the host, I had to resolve the issue myself. Luckily it wasn't anything too drastic.

    The MySQL database user's privileges had become corrupt. I had to remove that user, add a new user, attach the new user to the database and then simply update my wp-config.php file with the new details.

    I don't know how the user's privileges became corrupt, but I'm glad I didn't have to edit any tables or start messing with .htaccess etc. Sometimes the Internet is an absolute mystery! Case closed.

    Cheers!

  11. keesiemeijer
    moderator
    Posted 2 years ago #

    You're welcome. Glad you found a solution (and posted it here).

Topic Closed

This topic has been closed to new replies.

About this Topic