Chris
Chris

Reputation: 45

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?

Upvotes: 0

Views: 1524

Answers (2)

David Duman
David Duman

Reputation: 6656

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..

Upvotes: 0

Andrej
Andrej

Reputation: 7504

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.

Upvotes: 1

Related Questions