Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to copy a whole database with phpMyAdmin

This guide shows you how to make a duplicate of an existing database with all its tables and data.

Databases2 min read16 steps3 screenshots

Why copy a database?

A database is the place where your site keeps its data. A copy is useful when you want to test changes safely, or build a second version of your site. The original stays untouched. phpMyAdmin is a web tool for managing databases. You open it from cPanel, your hosting control panel.

Before you start

You need a new, empty database to hold the copy.

  1. Log in to your client area. Open your hosting service and log in to cPanel.
  2. Under Databases, click MySQL Databases.
  3. Under Create New Database, type a name and click Create Database.
  4. Add a user to the new database if the copy will be used by a site. See our guide on adding database users.

Copy using the Operations tab

  1. Go back to cPanel and open phpMyAdmin.
    Screenshot: Go back to cPanel and open phpMyAdmin .
  2. Click the database you want to copy, in the left list.
  3. Click the Operations tab.
  4. Find the box named Copy database to.
  5. Type the exact name of your new database. Include the cPanel prefix, which is your account name and an underscore.
  6. Choose Structure and data. This copies the layout and all rows.
  7. Tick Add DROP TABLE only if the target already has tables with the same names. It will replace them.
  8. Click Go.

When it finishes, you see a success message. Click the new database to check its tables.

Screenshot: When it finishes, you see a success message. Click the new database to check its tables.

Warning: Do not copy onto a database that holds live data unless you want it overwritten. Take a backup first.

Another way: export and import

If the copy option is missing, or the database is big, use export and import.

  1. Select the old database and click the Export tab.
  2. Keep the Quick method and format SQL. Click Go to download a file.
  3. Select the new database and click the Import tab.
    Screenshot: Select the new database and click the Import tab.
  4. Click Choose File, pick the downloaded file, and click Go.
Tip: If your site should use the copy, update the database name, user and password in its config file. For WordPress, this is wp-config.php.

Quick recap

  • Create a new empty database first.
  • Use Operations and Copy database to, choose Structure and data.
  • Or export the old one and import into the new one.
  • Back up before overwriting anything.