0

My wp-options keeps crashing and am getting "error establishing a database connecting" when I try loading the page. I don't know whats causing this to happen, I read somewhere that I might need more ram so i upgraded my plan to get 2GB of ram 40GB of space. But today it crashed again, I repaired it and went to the error logs and this the same error i get when the wp-option crashes

[14-Sep-2016 11:07:38 UTC] WordPress database error Table './DATABASE_Name/wp_options' is marked as crashed and should be repaired for query INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('_transient_mom_share_plusone_2020', '0', 'no') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`) made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/WDXYZ/single.php'), mom_single_post_content, mom_posts_share, set_transient, add_option

Please help me fix this issue.

6
  • what is the size of your options table? Sep 14, 2016 at 15:36
  • Thanks for replying, the size of my wp-option is 2.1 MiB Sep 14, 2016 at 15:38
  • can any one help me with this please. Sep 14, 2016 at 15:51
  • Before ask Question please do some research and if you still can't get the solution then ask Q to others. anyway have you seen this one ? stackoverflow.com/a/4357276/3967385
    – mlimon
    Sep 14, 2016 at 16:39
  • 1
    It is not normal for DB table to crash repeatedly, I would prompt hosting support to look into what is going on.
    – Rarst
    Sep 14, 2016 at 17:11

3 Answers 3

1

It sounds like you may be running a plugin that stores too many transient options. If you can't currently access wp-admin, try FTP'ing in and renaming your /plugins folder to disable all plugins. Then you should be able to log in to wp-admin. Next, back in FTP rename your /plugins folder back to the normal /plugins, and leave all of the plugins deactivated in wp-admin.

From there, go into phpMyAdmin and view the options table. Go to the last few pages and see if you notice any patterns - you may be able to tell which plugin is storing too much in the database, and then the solution is to remove the plugin and replace it with an alternative if you really need the functionality. Once you've found the culprit, run WP-Optimize ( https://wordpress.org/plugins/wp-optimize/ ) to clean up your database and reduce its size. It's a great plugin to run on a regular basis to keep things running smoothly.

1

Are you running Jetpack? If so, try updating it. See this:

https://wordpress.org/support/topic/jetpack-sync-killing-the-db/

0

I have find out that you can run cron job to automatically repair and optimize the database for you. By simply running this 2 cron jobs. You will have to create a .db_shadow file in your cpanel public_html and have the permission set to 0400 and past your root password.

mysqlcheck -Aos -u root -p"$(< .db_shadow)" > /dev/null 2>&1

/usr/bin/mysqlcheck -Aao --auto-repair -u root -p"$(< .db_shadow)"
1
  • I found a better cron job command that does both without calling for the user name and password /usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf --auto-repair --optimize --all-databases Sep 14, 2016 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.