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
Section titled “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
.sqlfile 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
Section titled “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
Section titled “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:
- Upload the file to your home directory (not
public_html) with FTP or File Manager. - Connect with SSH and run:
mysql -u cpuser_dbuser -p cpuser_dbname < yourfile.sqlFor a compressed file:
gunzip < yourfile.sql.gz | mysql -u cpuser_dbuser -p cpuser_dbnameReplace the user and database names with your own, and enter the database user’s password when asked. See Importing and exporting a MySQL database.
Option 4: Ask us
Section titled “Option 4: Ask us”Open a support ticket. 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
Section titled “Before you import”- Create the database and user first in cPanel’s Manage My Databases. See Managing MySQL databases and users.
- Remove
CREATE DATABASEandUSElines 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
DEFINERstatements. See 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.