You can upload databases that are 50MB or less into Cloud Sites using phpMyAdmin or myLittleAdmin database managers. However, if you need to import a database that exceeds 50MB, you will need to use a script and schedule a cron job to upload the database. See our article Creating Cron Jobs in Cloud Hosting for information on creating a cron job.
Below is a sample script that you can set up to upload a large database into Cloud Hosting.
#!/bin/sh mysql -h DB_HOST -u DB_USER -p'DB_PASSWORD' DB_NAME < /path/to/file/db_import.sql
Replace the placeholders with your actual information, definitions of the information needed are below:
- DB_HOST: The name of the database host.
- DB_USER: The name of the database user.
- DB_PASSWORD: The password of the target database.
- DB_NAME: The name of the database you are creating/restoring.
When creating the script, it needs to be saved and created as a perl/bash cron job. Once you build the script, you can upload it into your Cloud Hosting cron job.
|Do not store script files in your webroot directory, this can create a security issue. Use a non-public viewable directory to store any scripts.|