Ubuntu: How to Troubleshoot High CPU in MySQL

  1. Run ‘top’ to check PID of mysqld causes high CPU load
  2. Run the following command to check thread ID: pidstat -t -p <mysqld_pid> 1
  3. Login to mysql as root user and run the following command to get slow query causes high CPU load: select * from performance_schema.threads where THREAD_OS_ID = <TID>
From the image above we know TID 21936 is having 100% CPU load

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.