MySQL Commands You Should Have Committed to Memory Already
Dump the database
mysqldump -h database_host -uUsername -p database_name > dump.sql
Restore from the dump
If you need to create the database first:
mysqladmin -h database_host -uUsername -p create database_name
Then load the SQL file:
mysql -h database_host -uUsername -p database_name < dump.sql
Source
Build Your Own Database Driven Website Using PHP & MySQL, 2nd Edition (Page 133)
Comments
A few things to note:
mysqldump -u user -p database_name | gzip > dump_file.sql.gz--default_character-set=latin1 --skip-set-charsetWhat do you think about that?