I just went into a live online database via PHPMyAdmin and deleted 22,000 spam comments from a client’s WordPress blog all at once. That’s the first actual database operation I’ve ever done! Scary, even with a backup. Not that I want to make a habit of it — too much potential for destruction. But I can now claim to have executed a command that looks like this:
SELECT *FROM wp_comments WHERE comment_approved =”0″
delete from wp_comments WHERE comment_approved =”0″
And lived to tell the tale. Thanks to this guy for the instructions.