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

Copy a MySQL Database with phpMyAdmin

This guide shows how to make an exact copy of a database under a new name.

Databases2 min read18 steps5 screenshots

Why copy a database?

A database stores your website's data in tables. A table is like a spreadsheet page. A copy is useful in many cases. You can test a change on the copy and keep the original safe. You can also build a second version of a site. Or you can keep a quick backup.

phpMyAdmin is a web tool that lets you do this with clicks.

Method 1: The copy button

  1. Log in to your control panel and open phpMyAdmin.
    Screenshot: Log in to your control panel and open phpMyAdmin .
  2. Click the database you want to copy in the left list.
  3. Click the Operations tab.
  4. Find the box Copy database to.
  5. Type a new name for the copy.
  6. Choose Structure and data. This copies the tables and the rows inside them.
  7. Tick CREATE DATABASE before copying.
  8. Click Go.

The new database shows up in the left list.

Screenshot: The new database shows up in the left list.

On shared hosting, you may not be allowed to create databases from phpMyAdmin. If you see an error, use Method 2.

Method 2: Export and import

  1. In cPanel, open MySQL Databases. Create a new empty database and a user. Link them with all privileges.
  2. In phpMyAdmin, click the original database.
  3. Click the Export tab, keep Quick and SQL, then click Go.
  4. Click the new empty database on the left.
    Screenshot: Click the new empty database on the left.
  5. Click the Import tab.
  6. Choose the file you just saved and click Go.

Warning: Do not import into a database that holds data you want to keep. Importing may overwrite tables.

Use the copy with a website

A copy does not change your live site. To make a site use it, edit the site's settings file. Put in the new database name, user and password. For WordPress, the file is wp-config.php.

Tip: Copying a WordPress site? The old web address is saved in the data. Change it on the copy, or links will point to the old site.

Copy one table only

  1. Click the table name.
  2. Click Operations.
  3. Use Copy table to and type a new table name.
    Screenshot: Use Copy table to and type a new table name.
  4. Click Go.

Quick recap

  • Use Operations then Copy database to for a quick copy.
  • If that is blocked, export and import into a new empty database.
    Screenshot: If that is blocked, export and import into a new empty database.
  • Pick Structure and data to copy everything.
  • Update your site's settings to use the copy.