Programmically Saving MYSQL

software development

#1

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,

hammackj


#2

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.


#3

Just what I was looking for.

Thank you very much,
Jacob