Linux tip, Fedora tip / howto: Making a backup of all MySQL databases

 
back to notes and tips index

Try my online puzzle page with Calcudoku, Killer Sudoku and online Sudoku.

Making a backup of all MySQL databases

This is more of a short "note to self":

mysqldump --all-databases --force -u root -p

(--force makes it continue even when there are errors, try it without this option first)

If you also want all stored procedures in there, add the --routines option.

If you want just the structure (CREATE TABLE etc.), add the --no-data option.

To put the result in a file, append:
> <sql filename>
So for example:
mysqldump --all-databases --force -u root -p > all_db_backup.sql

To compress the result by a factor of 8-10:
gzip all_db_backup.sql
(use gunzip to decompress).


← back to notes and tips index
Please do not copy the text of this tip (© Patrick Min) to your web site.