MySQL Database

ID #241

How do I import a MySQL dumpfile into my database?

Applies to: Grid System

After you have dumped out your data into a file as described here, FTP or scp that dump file to the home directory (/) on our system.

Once you have uploaded the dump file to your account here, get a shell prompt on our system using telnet or ssh.

Now import the dump file into MySQL by typing all the following on 1 single line at the shell prompt:

mysql -p -h DBSERVER dbname < dbname.sql

The above assumes that your database name on our system is "dbname" and the dumpfile that you uploaded was named "dbname.sql". Replace those with your correct database name and dumpfile filename. Also replace DBSERVER with your correct database server name.

If you have followed this other FAQ on how to create a .my.cnf preference file, you would not have to type so much when connecting to the MySQL Monitor from the shell prompt. With a proper .my.cnf file you could have imported the dump by just typing this at the shell prompt:

mysql < dbname.sql

Last update: 2010-10-03 16:50
Author: FAQ Admin
Revision: 1.2

Digg it! Share on Facebook Print this record Send FAQ to a friend Show this as PDF file
Please rate this FAQ:

Average rating: 2.64 (75 Votes)

completely useless 1 2 3 4 5 most valuable

You can comment this FAQ

Comment of Anonymous:
More notes at
Added at: 2004-02-13 09:13

Comment of Anonymous:
you can also get to the mysql shell and then type "source file.sql", where file.sql is your dump file
Added at: 2009-04-18 00:55

Comment of Steffi:
If the sql file is under 8162 KB, an easier way to import it is to login to the control panel and PHPMyAdmin. Then go to the SQL tab to upload.
Added at: 2010-09-08 11:04

Comment of Cher:

That only works if your sql file is smaller than 5mb, which most developers will not be able to keep their databases to that limit, that would require breaking the import into a table by table import which would take eons.

I actually found this post because of the directions in the comments to use "source database.sql" in the mysql console as I am new to WAMP from MAMP.
Added at: 2011-01-11 11:24