Backing up or restoring only some tables of a database

It is not always worth copying the whole database. Before updating a plugin, deleting old orders or fiddling with a table, a copy of just the tables you are about to touch is enough. There are two ways: in phpMyAdmin, picking the tables, or on the command line, with their names after the database.

In phpMyAdmin

1 In cPanel open phpMyAdmin and pick the database.
2 On the Structure tab, tick the boxes of the tables you want. Under the list, in “with selected”, choose Export.
3 Alternatively open the Export tab, pick the Custom method and, in the tables box, select only the ones you need.
4 Leave the format on SQL. If you will restore into a database that already has these tables, tick the option that adds DROP TABLE; otherwise the import trips over the existing tables.
5 Save the file on your computer. The article exporting with phpMyAdmin explains the rest of the screen.

On the command line (SSH or the cPanel Terminal)

With access to a terminal, the table names go after the database name. The names abc_user and abc_database are examples: use your own, with the account prefix.

What you want The command
Just two tables mysqldump -u abc_user -p abc_database wp_posts wp_postmeta > posts.sql
Everything except one table mysqldump -u abc_user -p --ignore-table=abc_database.wp_options abc_database > rest.sql
Structure only, no data mysqldump -u abc_user -p --no-data abc_database > structure.sql
Restoring the file mysql -u abc_user -p abc_database < posts.sql

The -p asks for the password at the terminal, without leaving it written in the history. The full backup, with --single-transaction and compression, is in backing up with mysqldump and restoring the copy.

Restoring a file like this replaces the tables it carries. By default the copy starts by dropping each table (DROP TABLE) and creating it again. Everything that changed in those tables since the copy is lost. If in doubt, restore first into a test database you created in cPanel and compare.

A good habit: put the date in the file name (for example posts-2026-10-10.sql) and keep it outside the site’s public folder. A file like this holds all the table’s data, encrypted user passwords included, and must not sit where anyone who guesses the address can reach it.

Related tables travel as a group. In a shop, orders live in several tables at once. Restoring one without the others leaves inconsistent data: orders with no lines, products with no price. Copy and restore the whole group, main table and helpers together.
Need a table as it was yesterday, not today? The account’s daily copies hold the whole database, and you can restore from there. See how to restore your data with JetBackup. For a copy of your own, outside the panel: making and keeping your own backup.

Want help choosing what to copy before a big change? Tell us the application and the table.

Open a support ticket

SEE ALSO

Exporting a database with phpMyAdmin

Backing up with mysqldump and pg_dump, and restoring the copy

Importing with phpMyAdmin, and the size limit that stops you

Making and keeping your own backup, and testing that it works

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from 321,75 MT/mo (3-year plan, with coupon)

See plans
  • 0 Users Found This Useful
Was this answer helpful?