How to backup all mysql databases
In order to backup all mysql databases, you can run the following command in your linux command line:
The example below is configured with username “theuser” and password “thepass”.
mysqldump -utheuser -pthepass ?all-databases > all_dbs.sql
There’s a longer note on MySQL over here.
This dumps every database on the server into a single SQL file, which you can then compress and store offsite. I run this as a nightly cron job on smaller servers where a full managed backup solution would be overkill. For larger databases, consider adding --single-transaction to avoid locking tables during the dump, especially on InnoDB. You can also pipe the output through gzip to save disk space: mysqldump -utheuser -pthepass --all-databases | gzip > all_dbs.sql.gz.