phpMyAdmin lets you export a MySQL database to a file for backup or migration, and import a file back into a database to restore or move data. It works the same way whether your hosting account is on cPanel or DirectAdmin, since phpMyAdmin itself is the same tool in both. Only the way you open it differs.
Opening phpMyAdmin
In cPanel
- Log in to your cPanel account.
- Under the Databases section, click phpMyAdmin.
- Select the database you want to work with from the list on the left.
In DirectAdmin
- Log in to your DirectAdmin account.
- Under the Extra Features section (or Databases, depending on your DirectAdmin theme), click phpMyAdmin.
- Select the database you want to work with from the list on the left.
If you haven't created a database yet, do that first. See How to Create a MySQL Database and Database User.
Exporting a database
Exporting creates a .sql file containing your database's structure and data. This is useful before making risky changes, when moving a site to a new host, or when a developer asks for a copy of your data.
- With your database selected, click the Export tab at the top.
- Leave the export method set to Quick for a standard backup, or choose Custom if you want to select specific tables or export options.
- Confirm the format is set to SQL.
- Click Go. Your browser will download the .sql file.
Store the downloaded file somewhere safe. For a dedicated backup routine rather than a one-off export, see How to Back Up a Single MySQL Database.
Importing a database
Importing loads a .sql file's contents into a database, for example after restoring a backup or moving a site from elsewhere.
- Create or select an empty destination database.
- Open phpMyAdmin and select that database.
- Click the Import tab.
- Click Choose File and select the .sql file from your computer.
- Leave the format set to SQL and click Go.
Importing adds to or overwrites tables with matching names in the destination database. If you're restoring over an existing site, use an empty database unless you're sure you want the current data replaced. phpMyAdmin also has an upload size limit: if your .sql file is too large to import directly, compress it (.zip or .gz) before uploading, or ask your host to raise the limit.
If the import finishes without errors but your site still looks wrong, check that your site's configuration file (for example, wp-config.php for WordPress) points to the correct database name, username, and password, since importing data alone does not update those settings.