+254725682556 +254725052660 info@ziprof.co.ke
Client Area

Databases

How to Duplicate a MySQL Database in cPanel and DirectAdmin

You can duplicate a MySQL database by exporting the original database from phpMyAdmin and importing that file into a new, empty database. This gives you a full working copy: useful when you want to test an update, a plugin, or a code change without touching your live data. There is no single "duplicate" button on the main dashboard in either control panel, so this export/import method is the safest and most reliable way to do it on shared hosting.

Before You Start

You need a new destination database ready to receive the copy. Create an empty database and add a database user to it with all privileges first. If you have not done this before, see How to Create a MySQL Database and Database User.

Give the new database a clear name, such as adding _copy or _test to the end of the original name, so you don't confuse it with your live database later.

Duplicating the Database

phpMyAdmin works the same way in cPanel and DirectAdmin, so the steps below apply to both. Open phpMyAdmin from your control panel's dashboard.

  1. In the left-hand panel of phpMyAdmin, click the name of the database you want to copy.
  2. Click the Export tab at the top.
  3. Leave the export method set to Quick and the format set to SQL, then click Go. Your browser will download a .sql file containing the full database structure and data.
  4. Back in the left-hand panel, click the name of the new, empty database you created earlier.
  5. Click the Import tab at the top.
  6. Click Choose File and select the .sql file you just downloaded.
  7. Leave the format set to SQL and click Go.

Once the import finishes, phpMyAdmin will show a success message and the new database will contain an identical copy of every table and row from the original.

A Faster Option for Small Databases

If your database is small, phpMyAdmin also offers a shortcut that skips the separate download and upload:

  1. Select the source database in the left-hand panel.
  2. Click the Operations tab.
  3. Under Copy database to, type the name of the destination database and choose Structure and data.
  4. Click Go.
This shortcut needs permission to create a new database directly from phpMyAdmin, which some shared hosting accounts restrict. If the Copy database to option fails or the destination database is not created, use the export and import method above instead: it always works, since you are only writing into a database you already created.

If You're Duplicating a WordPress Database

A raw database copy is fine for testing on the same site, but if you plan to connect the copy to a separate WordPress installation, you will also need to update the wp-config.php file for that installation to point to the new database name, username, and password, and update the site URL stored in the wp_options table so links and assets resolve correctly.