Knowledge Base
How To Import a Large MySQL Database

You should be able to use the Online Manager to handle imports for databases which are less than 16 MB in size without issue.

However, there may be cases where you need to import database data that exceeds 16 MB.

One of the many options you have to handle this task in the Cloud Sites environment is a Perl or Bash script which you can schedule via a Cron job.

Here is an example to assist you with setting this up:

mysql -h DB_HOST -u DB_USER -p'DB_PASSWORD' DB_NAME < /path/to/file/db_restore.sql

Create a new text file and add the above code to it and save it as

In the above script, you will need to replace the portions in ALL CAPS with your actual information as follows:

/path/to/file/ — This is the absolute path to your files. You can find this path by clicking on Hosting, Cloud Sites, Features, and scrolling down. This will be the "Linux Path" listed there. An example would be: /mnt/target02/123456/ (Note, the filename is not included in that path)

DB_HOST - Database Host an example would be mysql5-9.wc1

DB_PASSWORD - the password of the target database

DB_USER - the database username

DB_NAME - the name of the database you are restoring to

Upload this file to your Cloud Site (for security purposes, we recommend keep this file outside your webroot) and create a cron job to schedule the task. Note, for step by step instructions on how to create a cron, Please review this article How_do_I_enable/disable_a_cron_job? [Article not yet available.]

Put the name of the file, which, in our example is in the "Command To Run" field. Select Perl as the Command Language and then select the minimum interval in which you wish to run your restore script (5 minutes).

There are logs available in your /logs/ folder each time a cron task is performed and you receive an email confirmation letting you know if the task was successful or not.

Please note: The Cron task has 15 minutes to complete. If the script takes longer than 15 minutes to complete, it will timeout. If this is a problem for you please break up the import into smaller pieces (.sql files) and re-schedule the task as necessary.

For more information on Cron and related tasks, please see the following articles [Articles not yet available.]:

Cron FAQ's:

What is a cron job? [Article not yet available.]

How do I enable/disable a cron job? [Article not yet available.]

How do I schedule a cron job? [Article not yet available.]

How do I create a cron job to backup my MySQL database? [Article not yet available.]


* takes no responsibility whatsoever for any files, code, content, database back-ups that are not made and/or are not made/done correctly. The information included on this knowledgebase page is usual and customary DB back-up procedures, but may not be complete. It is the client's responsibility to ensure that their site material is correctly backed-up. If a client prefers to make other arrangements or methods for backing up site material, it is at their sole discretion. always recommends that client back-up their entire site on a regular schedule.


Copyright 2011, a subsidiary of Group One Communications, Inc., All rights reserved worldwide.
Please review our Terms, Conditions, Policies, Procedures, Terms of Use and Service.