How to Delete all Records of a Table in phpMyAdmin

Updated on November 8, 2017

Recently my client’s WordPress site was flooded with fifteen thousand spam comments & posts. To protect the site, I advised the client to disable comments via Settings > Discussion and un-checking "

Caution:

Please take a backup of your database before performing below steps. Techglimpse.com is not responsible for any data loss.

In WordPress, all comments are stored in wp_comments table. So my client supposed to delete all comments (I mean all records of wp_comments table, because all of them were spams).

Here are the steps to delete all records of a table in phpMyAdmin.

Note:

Not everyone wants to delete all the comments. For instance, you might have few genuine comments which you may not want to loose. In such cases, you have to carefully identify spam comments and delete only those. You can also disable comments completely on media attachment pages

Option 1: Login to phpMyAdmin and click on the database on the left sidebar. Now phpMyAdmin will list all tables created in that particular database. To delete all records from wp_comments table, click on "Empty" link.

Delete all Records of a Table in phpMyAdmin

Click OK in the alert box to delete all the comments.

Option 2: You can also run SQL query to delete all records from a table. To do that, select the table you wish to delete records and click "SQL" tab. Delete the existing query in the query-box and click "DELETE" button located at the bottom. You will see query-box inserted with DELETE query as ‘DELETE FROM `wp_comments` WHERE 1'. Click Go and you are done.

Empty table phpmyadmin

Was this article helpful?

Related Articles

Leave a Comment