How to Import and Export a MySQL Database with phpMyAdmin — cPanel & Hosting How-Tos cPanel & Hosting How-Tos

How to Import and Export a MySQL Database with phpMyAdmin

By Genhost Team 2 min read

Exporting and importing databases is how you back up, move and restore the data behind your site. phpMyAdmin in cPanel handles it through a simple interface. Here’s how, including how to get past the size and timeout limits on bigger databases.

Export a database (backup or move)

  1. In cPanel, open phpMyAdmin.
  2. Select your database from the list on the left (check wp-config.php for the name if unsure).
  3. Click the Export tab.
  4. Choose Quick export and the SQL format.
  5. Click Go — a .sql file downloads to your computer.

That .sql file is a complete copy of the database. Keep it as a backup, or use it to move the site.

Import a database

  1. In phpMyAdmin, select the target database (ideally an empty one you’ve created in cPanel).
  2. Click the Import tab.
  3. Choose File and select your .sql file.
  4. Leave the format as SQL and click Go.

When it finishes, the tables and data are in place. For a moved site, update the app’s config (for WordPress, wp-config.php) to point at the new database.

Importing can overwrite tables that already exist. Import into an empty database, or back up first.

Handling large databases

phpMyAdmin limits how big a file you can upload in the browser. If your import is too large:

  1. Compress it. Zip or gzip the .sql file and import the .zip/.gz directly — phpMyAdmin accepts compressed imports, and smaller files upload within the limit.
  2. Raise PHP limits. Increase upload_max_filesize, post_max_size and max_execution_time — see increase PHP limits.
  3. Use the command line. With SSH enabled, import with no browser-size limit:
    mysql -u DBUSER -p DBNAME < backup.sql
    

Repair or optimize while you’re there

phpMyAdmin can also repair a corrupted table or optimize tables to reclaim space: select the tables, then choose Repair table or Optimize table from the “With selected” dropdown. This can fix a database that’s throwing errors.

Part of every migration

Importing and exporting databases is a core step when you migrate a website or recover one. Every Web Hosting and WordPress Hosting plan includes phpMyAdmin on fast NVMe storage, and our support team can help with a large or stubborn database import.

Frequently asked questions

How do I export a database in phpMyAdmin?

Open phpMyAdmin in cPanel, select the database on the left, click the Export tab, choose the Quick method and SQL format, and click Go. You get a .sql file containing the whole database, ideal for a backup or a move.

My database is too large to import in phpMyAdmin. What do I do?

phpMyAdmin has an upload size limit. Compress the .sql file to .zip or .gz and import that, raise the PHP upload and execution limits, or for very large databases import from the command line with SSH, which has no browser-size limit.

Will importing a database overwrite the existing one?

An import adds or replaces the tables in the .sql file. If you import into a database that already has those tables, it can overwrite their data. Import into an empty database, or back up first, to avoid losing anything.