WordPress uses the wp_commentmeta and wp_comments tables to store comments and their data.
To delete all comments in WordPress simply empty those tables in the database:
TRUNCATE `wp_comments`;
TRUNCATE `wp_commentmeta`;
To delete all spam comments use:
DELETE FROM `wp_comments` WHERE `comment_approved` = 'spam';
To delete all unapproved comments use:
DELETE FROM `wp_comments` WHERE `comment_approved` LIKE ('0');
NOTE: In the above commands change wp_ prefix with the table prefix that you are using *(view it in wp-config.php file).

Another option to delete the SPAM, Pending, or ALL comments from the WordPress website is a free plugin:
Was this post helpful?
Let me know if you liked the post. That’s the only way I can improve. 🙂