Posts Tagged ‘MySQL using all cpu’

MySQL – Using 100% of CPU

July 20th, 2010

Sometimes you’ll notice that MySQL is using 100% or more of the CPU (more if you have multiple cores).

If you have a php based website take a look at the php.ini and see if the following is on or off:

; Allow or prevent persistent links.
mysql.allow_persistent = Off

If it is ON, turn it off and restart apache and mysql. It will most likely resolve the issue. If it does not take a look at the slow logs and see if you can identify a table whos queries are taking longer then usual. To turn on this feature visit the following for instructions :

MySQL turn on Slow Logs

Once you Identify the table/tables that are slowing things down, you will most likely need to re-index the table to optimize the query. This should resolve the 100%+ issue.

if you found this helpful feel free to donate to:
ZEC: t1NQp1UuqQbmnXzazbLTSreS2AbaZpRBuTM
LTC: LZyNF1qkBUA7XFz83m5xwzGgmmj1owQn9d