Site: US UK AU |

How to truncate MySQL tables

How to truncate MySQL tables

This article explains how to truncate MySQL tables with the phpMyAdmin control panel and with the MySQL CLI.


The truncate table operation functions as a quick way to remove all rows from a table while leaving the table itself intact. You cannot roll back this operation since truncate table bypasses DML to achieve faster performance.

Truncating tables with SiteWorx

You can perform the truncate table operation from SiteWorx with the following procedure:

  1. Log in to your SiteWorx account.

  2. On the left, select Hosting Features > MySQL > PhpMyAdmin (Figure 1).

Figure 1. Hosting Features > MySQL > PhpMyAdmin selection in SiteWorx.

  1. Select the correct database from the list on the left (Figure 2).

Figure 2. Database selection in phpMyAdmin.

  1. Select the check box corresponding to the desired table from the Table List (Figure 3).

Figure 3. Check boxes for table selection in phpMyAdmin.

  1. From the With selected list, click Empty (Figure 4).

Figure 4. With selected > Empty selection.

  1. Click Yes when prompted.

Truncating tables with MySQL CLI/SSH

Use the following procedure to perform the truncate table operation using the MySQL CLI:

  1. Log in to your hosting account using SSH:

mysql -u [username] -p [database_name)

For example:

mysql -u johndoe -p data_mysite

  1. Enter your password.

  2. Execute:

    truncate table [table_name]

External resources

For the complete MySQL documentation, refer to the MySQL website

For 24-hour assistance any day of the year, contact our Support Team by email or through the Client Portal.

Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
How to delete a MySQL database with SiteWorx
Added on Tue, Jul 30, 2013
How to create a pointer domain with SiteWorx
Added on Tue, Aug 6, 2013
Changing the password for a MySQL database user
Added on Tue, Jul 30, 2013
What is MySQL Replication?
Added on Thu, Aug 28, 2014
How to activate two-factor authentication in SiteWorx
Added on Tue, Nov 28, 2017
How to show running MySQL queries
Added on Fri, Nov 13, 2015
How to manage firewall whitelists in SiteWorx
Added on Wed, Nov 12, 2014
How to enable SSH access
Added on Tue, Jun 6, 2017
What is SiteWorx?
Added on Thu, Aug 28, 2014
How to purchase a Wildcard SSL certificate
Added on Wed, Jan 14, 2015