MySQL

How to Truncate a Table (Remove All Data but Keep Structure)

Truncate a MySQL table on Nobregas Panel to remove all data while keeping the table structure and columns intact. Fast, irreversible, one-click.

2 min read 9 views Updated Mar 17, 2026

Sometimes you need to wipe all data from a table without deleting the table itself — for instance, when resetting test data or clearing a staging environment. The Nobregas MySQL Panel provides a Truncate feature that empties a table in one click while preserving its structure.

What Does Truncate Do?

Truncating a table:

  • Removes all rows from the table instantly.
  • Keeps the table structure — columns, data types, indexes, and keys remain unchanged.
  • Resets the auto-increment counter — The next inserted row starts from 1 again.
  • Is faster than DELETE — Truncate does not scan row by row; it drops and recreates the table internally.
  • Cannot be undone — Once truncated, the data is gone permanently.

How to Truncate a Table

  1. Log in at mysql.nobregas.org.
  2. Navigate to Databases > click Manage on your database.
  3. In the tables list, find the table you want to truncate.
  4. Click the Truncate button (yellow, with an eraser icon) on that table's row.
  5. A confirmation dialog appears warning that all rows will be deleted.
  6. Click Truncate to confirm.

A success notification appears and the table is now empty. Click into the table to verify — it will have zero rows but all columns intact.

Truncate vs. Drop vs. Delete

Action Removes Data Removes Table Resets Auto-Increment Speed
TRUNCATE Yes No Yes Fastest
DROP Yes Yes N/A Fast
DELETE (all) Yes No No Slowest
  • Use Truncate when you want to clear all data but keep the table for new data.
  • Use Drop when you no longer need the table at all.
  • Use DELETE when you need to remove specific rows based on conditions.

When to Use Truncate

Common scenarios:

  • Resetting test data — Clear all test records before a new testing cycle.
  • Staging environment cleanup — Wipe staging data before importing fresh production data.
  • Log table rotation — Clear a logs table that has grown too large.
  • Starting fresh — When you want to re-import data from a backup or CSV file.

Before You Truncate

  • Create a backup first if the data might be needed later.
  • Check foreign keys — Tables with foreign key relationships may prevent truncation. You may need to truncate child tables first.
  • Inform your team — If others are using the database, let them know the table will be emptied.

Was this article helpful?