• I was trying to do some maintenance to the Ubuntu server running mysql and apache2 using these commands:

    SELECT table_schema AS “Database”, sum(data_length + index_length)/1024/1024 AS “size in MB” FROM information_schema.TABLES GROUP BY table_schema;

    optimize table wp_commentmeta, wp_comments, wp_links, wp_odb_logs, wp_options, wp_postmeta, wp_posts, wp_term_relationships, wp_term_taxonomy, wp_termmeta, wp_terms, wp_usermeta, wp_users, wp_yoast_seo_links, wp_yoast_seo_meta;

    Then I went to the Feedback section of WordPress to delete old feedback around 24. Select them all and clicked send to trash.
    Usually this process is quick. But it was taking a long time.
    So I restarted the server, and now, mysql is taking all the cpu usage.

    Anyway to troubleshoot and fix this problem?
    Thanks,

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    The proper course of action is to restore from a known good backup. If one is not available it doesn’t look promising. Try creating a new DB for WP to use and update wp-config.php accordingly. Export all WP tables from the problem DB and import them into the new. Hopefully whatever had gotten corrupted does not get transferred as well.

    If there is a large amount of data in the DB that is no longer relevant, you should only export the relevant portions to minimize potentially problematic data. In the phpMyAdmin app you can export the results of SQL or search queries instead of full tables. With partial imports, identify the largest imported ID value and set the destination table’s auto-increment value to that value + 1.

    Thread Starter wpmhweb

    (@wppit)

    Thanks, because I couldn’t find an answer soon, I ended up rebuilding the server and using the day before db.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘High CPU usage with mysql on WordPress’ is closed to new replies.