I was just doing a clean up of my wordpress databases and realised that the SPAM comments were still being recorded in the akismet history, so after an extensive search I found an easy solution to removing the entire history files without removing the approved comments and pingbacks.
I now use this procedure to remove Akismet history from my database:
- Go into control panel dashboard and find phpMyAdmin
- On the left hand side select the database associated with the website I want to work on (such as _wrdp1)
- Take a copy of the database before making any changes by selecting EXPORT and press go. Download the sql file to a safe place.
- Go to wp_commentmeta
- Select the SQL tab
- Copy and paste the query below (making sure to add the correct database name if it has been changed for security reasons) and press go. It generally takes less than a second to remove all the history and free up the database space again. Bravo!
DELETE FROM wp_commentmeta WHERE meta_key LIKE ‘%akismet%’