If you have a compressed MySQL database in bz2 format that you need to import, just do the following:
bunzip2 < db_filename.sql.bz2 | mysql -u root -p target_db_name
While automated backups are important, sometimes you just want to take a quick and dirty snapshot before making a change to your data.
The mysqldump command is used to create textfile “dumps” of databases managed by MySQL. These dumps are just files with all the SQL commands needed to recreate the database from scratch. The process is quick and easy.
If you want to back up a single database, you merely create the dump and send the output into a file, like so:
mysqldump database_name > database_name.sql
Multiple databases can be backed up at the same time: (more…)