# Back up and import a database with phpMyAdmin: export, import and the large-file limit

https://www.gyrohosting.com/en/knowledgebase/article/phpmyadmin-export-import-database

- **What you will learn**: How to take a `.sql` backup of your database with phpMyAdmin in cPanel (export), load that backup into another database (import), and what to do when the file is bigger than the upload limit shown on screen.
- **Time**: 10 minutes (depends on database size)

## 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.

![Open phpMyAdmin in the Databases section of the cPanel home page.](https://www.gyrohosting.com/resources/uploads/bilgi-merkezi/B36-01-en.webp)

## 2. Export the database (take a backup)

1. Open **phpMyAdmin**. It opens in a new tab and doesn't ask for another password.
2. Click your site's database in the left-hand list. If you're not sure which one it is, check the `DB_NAME` line of `wp-config.php` in **File Manager**.
3. Open the **Export** tab at the top.
4. Leave **Export method** on **Quick** and **Format** on **SQL**.
5. Click **Export**. Your browser downloads a `databasename.sql` file.

![Select the database on the left and open the Export tab; export with the Quick method and SQL format.](https://www.gyrohosting.com/resources/uploads/bilgi-merkezi/B36-02-en.webp)

> **Info**
> 
> 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

1. Choose **Custom** as the **Export method**.
2. In the **Output** section below, leave **Save output to a file** selected.
3. Choose **gzipped** in the **Compression** list.
4. Click **Export** at the bottom of the page. The file downloads as `.sql.gz`.

![For large databases choose the Custom method and pick gzipped in the Compression list.](https://www.gyrohosting.com/resources/uploads/bilgi-merkezi/B36-03-en.webp)

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)

1. The database you import into should be empty. If you don't have one, create it first with **Database Wizard** (B35).
2. 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.
3. Open the **Import** tab at the top.
4. Under **File to import**, choose your `.sql`, `.sql.gz` or `.sql.zip` file with **Choose File**. The maximum file size is shown next to **Browse your computer** (for example **Max: 128MiB**).

![Select the empty database and open the Import tab; the maximum upload size is shown next to the file selection.](https://www.gyrohosting.com/resources/uploads/bilgi-merkezi/B36-04-en.webp)

1. Leave **Partial import** on. **Format** should be **SQL**.
2. Click **Import** at the very bottom. When it finishes you see a green success message and the number of queries run.

![Leave partial import on, keep the format as SQL, then click Import.](https://www.gyrohosting.com/resources/uploads/bilgi-merkezi/B36-05-en.webp)

1. Check that the tables appear in the left-hand list. For WordPress, make sure the database name, user and password in `wp-config.php` point to this database (B35).

> **Warning**
> 
> 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:

1. **Compress it.** Export the file as `.sql.gz` or `.sql.zip` (section 2), or zip it on your computer. phpMyAdmin accepts compressed files directly.
2. **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.
3. **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**.
4. **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 example `username_gyroproje.sql.gz`).

![On the cPanel Backup page you can download a database backup as a compressed file and restore it.](https://www.gyrohosting.com/resources/uploads/bilgi-merkezi/B36-06-en.webp)

1. 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.

> **Info**
> 
> 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).

> **Did you know?**
> 
> 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
