Mysql – Securing MySQL backup process

MySQLmysqldumppercona

I'm running my MySQL backups through cron scheduled every night, but the thing is in cron the username and password is given for it run, is there any other way I can securely run the backups? where I can credentials remain secure only to the DBAs and not to anyone else? Btw, I use percona server. But I use mysqldump for backups, just that it has to be secure.

Thanks!

Best Answer

You can create a .my.cnf file in your home directory then store the user/password info on the [mysqldump] section.

vi ~/.my.cnf

[mysqldump]
user = dump_user
password = dump_password

Then, with your mysqldump command, use the --defaults-extra-file option to specify explicitly your conf file has your are in crontab.

/usr/bin/mysqldump --defaults-extra-file=/home/max/.my.cnf  --single-transaction  --all-databases >/space/mydump.sql

Max.