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 change permissions for MySQL users
Added on Mon, Jul 29, 2013
How to purchase standard SSL certificates
Added on Fri, Sep 14, 2018
How to create MySQL database user accounts in SiteWorx
Added on Mon, Aug 5, 2013
How to change email account passwords in SiteWorx
Added on Mon, Aug 5, 2013
How to generate a CSR
Added on Thu, Jun 7, 2018
How to download backup files with SiteWorx
Added on Tue, Aug 6, 2013
How to show running MySQL queries
Added on Fri, Nov 13, 2015
How to restore partial backups with SiteWorx
Added on Tue, Aug 6, 2013
How to secure your SiteWorx account
Added on Tue, Dec 9, 2014
What is phpMyAdmin?
Added on Fri, Sep 5, 2014