# Importing a large database

> phpMyAdmin says your database file is too big, or the import times out? Here's how to compress, split or import it another way.

Source: https://helpcenter.ruachost.com/cpanel/databases/importing-a-large-database/

phpMyAdmin on Ruachost hosting can import files up to **512 MB**. Larger files, or very large imports that take a long time, can fail with "file too large", a timeout, or "MySQL server has gone away". Try these options in order.

## Option 1: Compress the file

phpMyAdmin imports compressed files directly, and database exports compress very well, often to a tenth of their size.

- Compress your `.sql` file as `.sql.gz` (gzip) or `.zip`.
- On Windows, use 7-Zip and choose **gzip**. On macOS or Linux, run `gzip yourfile.sql`.
- Import the compressed file in phpMyAdmin's **Import** tab as normal.

Exporting from another phpMyAdmin? Choose **Custom** export and set **Compression** to **gzipped**.

## Option 2: Split the file

Use a free tool such as **SQLDumpSplitter** or BigDump to split the `.sql` file into smaller parts, then import the parts one at a time, in order.

## Option 3: Import with SSH

If SSH is enabled for your account, the command line has no file-size limit and is the fastest option:

1. Upload the file to your home directory (not `public_html`) with FTP or File Manager.
2. [Connect with SSH](https://helpcenter.ruachost.com/cpanel/guides/how-to-use-ssh-secure-shell-on-windows-and-mac-to-access-your-account/) and run:

```bash
mysql -u cpuser_dbuser -p cpuser_dbname < yourfile.sql
```

For a compressed file:

```bash
gunzip < yourfile.sql.gz | mysql -u cpuser_dbuser -p cpuser_dbname
```

Replace the user and database names with your own, and enter the database user's password when asked. See [Importing and exporting a MySQL database](https://helpcenter.ruachost.com/developers/databases/importing-and-exporting-a-mysql-database/).

## Option 4: Ask us

[Open a support ticket](https://dashboard.ruachost.com/submitticket.php). Upload the file to your home directory first, and tell us its name and which database to import it into. We'll import it for you.

## Before you import

- **Create the database and user first** in cPanel's **Manage My Databases**. See [Managing MySQL databases and users](https://helpcenter.ruachost.com/cpanel/databases/managing-mysql-databases-and-users/).
- **Remove `CREATE DATABASE` and `USE` lines** from the file if it was exported from another host. On shared hosting, database names must start with your cPanel username, so import into the database you created.
- **"Access denied; you need the SUPER privilege"?** The file contains `DEFINER` statements. See [Troubleshooting MySQL definer issues](https://helpcenter.ruachost.com/developers/databases/troubleshooting-mysql-definer-issues/).
- **Moving from another cPanel host?** We'll move your whole website, including databases, for free. See [Moving your website to Ruachost](https://helpcenter.ruachost.com/getting-started/guides/migrating-an-account-from-another-web-host-to-ruachost/).
