Dumping database to file:
mysqldump -u mysql_username -p name_of_database > databasefile.sql
Restoring database from file:
mysql -u mysql_username -p name_of_database < databasefile.sqlCompressed dump and restore: Dump and compress database to archive file:
mysqldump -u mysql_username -p name_of_database | gzip -9 > backupfile.sql.gzRestore compressed database file:
gunzip < backupfile.sql.gz | mysql -u mysql_username -p name_of_database