2 commands I use often throughout the day is importing and exporting large databases into MySQL VIA the command line. Here is how I do it where “USERNAME” is your username, “PASSWORD” is your password and “DATABASE” is your database name.
To Export:
MySQL
1 |
mysqldump -uUSERNAME -pPASSWORD DATABASE | gzip -c > ~/dump_2010-06-14.sql.gz |
To Import:
MySQL
1 |
mysql -uUSERNAME -pPASSWORD DATABASE < database.sql |
Also, you may have a large database that may give you errors while importing. You can use this command to force the import without warnings or errors:
MySQL
1 |
mysql -f -uUSERNAME -pPASSWORD DATABASE < database.sql |