简体   繁体   中英

MySQL DB Backup - Secure way

I want to schedule a cron job that either uses mysqldump directly, or calls a script that does the mysqldump. My question is since mysqldump requires a password to be supplied, is it secure to do mysqldump directly as a cron job? If not, while using a script, what's the most secure way of protecting the password?

I think you should:

  1. Create file which will store you login/password and set minimal permissions on it.
  2. Create bash script/php/perl script which will run mysqldump command and read settings from this file.
  3. Set this script to cron.

But if you run cron under root so you can specify user/password directly in cron because onlyrestricted number of users can look through this file.

you can write password into script file and set it's permission root user only. than define it in crontab.

no one can see it unless logged in as root user. if someone else can login as root user mysql password wont be your primary problem anyway..

also you can use a specific user instead of root with only necessary permissions..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM