Programmically Saving MYSQL

software development


Is there anyway to programmically, back up all data in a database with mysql from the shell? I know phpMyAdmin will do it but I do not know the exact shell command/script that will do it.

Thank you,



Write a shell script with the following command for each database you want to back up and run it from cron every night.

mysqldump -h <hostname> -u <username> -p<password> <database> \ | gzip -9 > $HOME/backup/mysql/<database>.sql.gz Make sure the backup directory actually exists in your home directory, of course.

If you want useful replies, ask smart questions.


Just what I was looking for.

Thank you very much,