Back up and import a database with phpMyAdmin: export, import and the large-file limit
1. Why and when?
The database holds your WordPress site's posts, pages, users and settings. It is as important as your files and needs its own backup. You export it:
- Before a major plugin, theme or PHP version change (B34).
- When moving your site to another account or server.
- When preparing a test copy (B37).
Importing means loading that backup back into a database.
The tool is in the Databases section of the cPanel home page.
2. Export the database (take a backup)
- Open phpMyAdmin. It opens in a new tab and doesn't ask for another password.
- Click your site's database in the left-hand list. If you're not sure which one it is, check the
DB_NAMEline ofwp-config.phpin File Manager. - Open the Export tab at the top.
- Leave Export method on Quick and Format on SQL.
- Click Export. Your browser downloads a
databasename.sqlfile.
Keep the downloaded file on your computer or in your cloud storage. Don't open and edit it; a single broken character can stop an import.
Export a large database compressed
- Choose Custom as the Export method.
- In the Output section below, leave Save output to a file selected.
- Choose gzipped in the Compression list.
- Click Export at the bottom of the page. The file downloads as
.sql.gz.
SQL files are plain text, so they usually shrink a lot when compressed. That speeds up the download and helps you stay under the import limit.
3. Import the database (load the backup)
- The database you import into should be empty. If you don't have one, create it first with Database Wizard (B35).
- In phpMyAdmin, click the target database in the left-hand list. Make sure it's the right one; importing overwrites tables with the same names.
- Open the Import tab at the top.
- Under File to import, choose your
.sql,.sql.gzor.sql.zipfile with Choose File. The maximum file size is shown next to Browse your computer (for example Max: 128MiB).
- Leave Partial import on. Format should be SQL.
- Click Import at the very bottom. When it finishes you see a green success message and the number of queries run.
- Check that the tables appear in the left-hand list. For WordPress, make sure the database name, user and password in
wp-config.phppoint to this database (B35).
Before importing into the database your live site uses, always export that database too. An import can't be undone.
4. What if the file is over the limit?
phpMyAdmin's upload limit is the value shown next to Browse your computer on the Import screen. It is separate from your site's PHP settings (upload_max_filesize in B34); raising that value in INI Editor doesn't change the phpMyAdmin limit. Try these in order:
- Compress it. Export the file as
.sql.gzor.sql.zip(section 2), or zip it on your computer. phpMyAdmin accepts compressed files directly. - Split it. In a Custom export, select the tables in several batches, or use Export tables as separate files. Then import the files one by one.
- Resume an interrupted import. If an import stops because of a timeout, phpMyAdmin tells you where it stopped. Select the same file again and enter that number in Skip this number of queries (for SQL) starting from the first one.
- Use cPanel Backup. On the Backup page in the cPanel Files section, Download a Database Backup downloads your database as
.sql.gz, and Restore a Database Backup restores a file in the same format. The restore goes into the database named in the file name, so the file name must match the database's full name (for exampleusername_gyroproje.sql.gz).
- If none of these works, open a support ticket with the file size and the database it should go into. Don't attach the file to the ticket.
If you're moving from another cPanel server, our team can move your whole site for you. Free migration covers cPanel to cPanel, up to 2 sites; just open a support ticket to request it.
5. Common problems
| Symptom | Cause | Fix |
|---|---|---|
| "You probably tried to upload a file that is too large" | The file is bigger than the limit shown | Use the methods in section 4. |
| "#1050 - Table ... already exists" | The target database already has the same tables | Import into an empty database, or back up and remove the old tables first. |
| "#1044 - Access denied ... to database" | The file contains CREATE DATABASE or another database name |
Select the target database on the left and import; export the file again with the Quick method. |
| Accented characters look broken | Character set mismatch | Choose utf-8 as Character set of the file, and export with utf-8 too. |
| The import stopped halfway | Timeout | Resume with Partial import or split the file. |
| The site opens but shows old content | wp-config.php points to another database |
Update the DB_NAME line with the new database's full name. |
6. FAQ
Does exporting also back up my site's files?
No, only the database. For uploaded images, theme and plugin files, compress and download them in File Manager, or use the Softaculous Backup feature.
Doesn't my hosting plan have automatic backups?
As stated on our hosting page, daily and weekly backups are taken for accounts up to 2 GB. We still recommend taking your own backup before major changes; that copy is always in your hands.
Can you raise the file limit?
Compressing and splitting are enough in most cases. If they aren't, open a support ticket and we'll find the right method with you.
Which database should I select when importing?
Select the empty database you want to load the backup into in the left-hand list. If you import without selecting a database, you may get errors depending on the commands in the file.
I moved my WordPress site to another domain. What needs to change?
The site addresses in the database still point to the old domain. Update siteurl and home in the _options table; the Softaculous Clone feature does this for you (B37).
A WordPress site installed with Softaculous can be backed up in one go, files and database together, with the Backup button, and restored from the same screen (B40).
Next step
- B35: Creating a MySQL database and user
- B37: Copying a WordPress site (staging and cloning)
- B40: Cleaning up a hacked WordPress site
Thanks for your feedback!
