PDA

View Full Version : best way to do mysqldump programatically



badperson
May 29th, 2011, 04:37 PM
Hi,
I have a java jsp/servlet web app running on my home server that connects to a mysql database. I have system where I can dump the data as xml (my own schema) but I would also like to be able to do a weekly mysqldump.

Can I do this in a bash script without having to manually enter the pw for ubuntu and the pw for mysql?

Also, is it best to do that kind of thing in a bash scipt, a separate server admin kind of function? Or should it be done from the java app?

thanks!
bp

LoneWolfJack
May 29th, 2011, 06:17 PM
mysqldump -u<username> -p<password> -Ace | gzip > dbdump.txt.gz

doesn't really matter from where you run this command.

Some Penguin
May 30th, 2011, 02:28 AM
http://www.techiecorner.com/1619/how-to-setup-mysqldump-without-password-in-cronjob/

seems relevant.