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.


  • What do you mean by secure? There must be defined threats so you can measure how your backups are protected against them.
    – akuzminsky
    Oct 5 '15 at 18:50

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

vi ~/.my.cnf

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



You should take a look at mysqldump-secure which acts as a wrapper around mysqldump and will take care about password security (via a defaults-extra-file) and also offers your to encrypt your mysql databases via asymmetric encryption.

Optional support for Nagios monitoring is also included and can be turned on via the config file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.