SSH command for backing up MySQL Databases using a CRON job

Need to dump your databases on a daily hourly basis? How about hourly or every 15 minutes? We have you covered.

How to backup all databases for all users via SSH in Linux (using root) and gzip the output


15 2 * * * root mysqldump -u root -p[YOURPASSWORD] –all-databases | gzip > /mnt/disk2/database_data ' %m-%d-%Y'.sql.gz

Note – p[YOURPASSWORD] = -p123456 where your password is “123456”.

How to backup a single database for a single user via SSH in Linux (no compression)

mysqldump -u[USERNAME] -p[PASSWORD] DATABASE > your_backup.sql


Want to discuss a project?

  • This field is for validation purposes and should be left unchanged.