mysqldump – i often use these to copy tables from one server to another since i find the phpmyadmin dump to be very slow and sometimes i get a page timeout. aside from copying a database to another you can also use it to backup your database or all of your databases. a mysql dump file contains sql statements to create databases, populate tables, or populate rows. Most of the time i saved the dump file as a .sql but you could also specify to save it as a .csv or perhaps .xml etc.
When restoring it i use the command \. on the mysql command prompt, i find it much easier that way than typing it on the shell.
i keep on forgetting the syntax to these commands so i better jot them down. These are syntax from the manual and is the most common syntax used in creating a mysql database dump.
shell> mysqldump [options] –databases db_name1 [db_name2 db_name3...]
shell> mysqldump [options] –all-databases
example in backing up the mysql database:
dump all databases:
and restoring it back:
this is what I use:
add it in cron:
date=`date -I`
mysqldump –opt –all-databases | bzip2 -c > /var/backup/backup-$date.sql.bz2





Hey can anyone explain what is this all about.