Troubleshooting database imports on hostgator or other shared hosts
When restoring an old MySQL-based site on Hostgator, I tried to use phpMyAdmin to import the database dump-file. It failed to import no matter how I cut the file up into segments or compressed it. It just kept erroring out, suggesting the file was too large – even when it definitely wasn’t. Here’s how to get around this problem:
You will have to enable SSH Access on your hosting account. For hostgator, the instructions for getting started with SSH are here:
hostgatorusername$ ssh -p 2222 hostgatorusername@WEBSITE.IP.ADDRESS
where “hostgatorusername” is the username on your hosting account.
My-iMac:~ hostgatorusername$ ssh -p 2222 hostgatorusername@WEBSITE.IP.ADDRESS hostgatorusername@WEBSITE.IP.ADDRESS's password: [type password here] Last login: Sat Jun 29 11:01:24 2013 from c-95-260-217-8.hsd1.mi.comcast.net
-jailshell-4.1$
mysql -u hostgatorusername_databaseuser -p -f hostgatorusername_databasename < /home/sitename/path/to/backupfile.sql
where
hostgatorusername_databaseuser is the complete database username
and
hostgatorusername_databasename is the complete database name
and
/home/sitename/path/to/backupfile.sql
Sample session:
jailshell-4.1$ mysql -u hostgatorusername_databaseuser -p -f hostgatorusername_databasename < /home/sitename/path/to/backupfile.sql Enter password: [type password here]
Resources
And just in case upload limits are really your problem: