How to Import and Export a MySQL Database

Export a MySQL database to a .sql file and import it back through phpMyAdmin to move, migrate, or back up your data.

· Updated · 2,983 views

Exporting and importing databases is how you move a site between hosts, take a manual backup, or restore data after a change. phpMyAdmin handles both through the browser.

Export a Database

  1. Open phpMyAdmin from the Databases section in cPanel.
  2. Click the database name in the left sidebar to select it.
  3. Click the Export tab at the top.
  4. Leave the method on Quick and the format on SQL.
  5. Click Export. A .sql file downloads to your computer.

For very large databases, choose the Custom method and enable "Save output to a file" with gzip compression to reduce the file size.

Import a Database

Before importing, create an empty database and user in MySQL Databases if you do not already have one.

  1. In phpMyAdmin, select the target database in the left sidebar.
  2. Click the Import tab.
  3. Click Choose File and pick your .sql file.
  4. Leave the format as SQL and click Import.

The page confirms success when the import finishes.

Handling Large Files

phpMyAdmin has an upload size limit, often around 50 MB. If your file is larger:

  • Compress it to .sql.gz before uploading, which often brings it under the limit.
  • Or upload the .sql file to your account with File Manager and use the command line if you have terminal access.

| Symptom | Likely cause | |----------------------------|---------------------------------------| | "Table already exists" | Importing into a non-empty database | | Upload stops part way | File exceeds the upload size limit | | "Unknown collation" | Source and target MySQL versions differ |

If imports keep failing on size, contact support on WhatsApp at +254 796 358081 and the file can be imported server-side for you.

Was this article helpful?

Your feedback helps us improve our documentation.

Still Need Help?

Our support team is available 24/7 to assist you.