I had created a script that uses rsync to backup some directories of the production servers to a dedicated one. I would also like to perform a backup of the directory /var/lib/mysql/some_database.

As cron task that executes the backup is associated to a user different than root, I need to set some permissios on the /var/lib/mysql/ directory.

As far as I know, it is only needed that the user can navigate (execute) through the some_database/ directory and the files that are placed inside it, have read permissions.

Which are the more proper permissions that I should use?

Thanks in advance for the help, Best regards!


doing a backup of /var/lib/mysql is not a good idea, because the mysql daemon needs to be stopped before.

use tools like mysqldump to dump the databases into a file in e.g. /var/backups/mysql/ or whereever and backup these files

the dump of the databases can be started by the user creating the backup, so there will be no problems. but think of removing rights on the folder for group and world if you do not need them

  • Hi! The backup is done by night, when is certainly sure that the system is not being used. So, if I add instructions to stop the mysql daemon before the database is copied and then start the daemon again, will be a acceptable approach? Thanks for the help, Best regards! Jul 29 '10 at 9:55
  • @ruigoncalves: You could do a manual backup, but a MySQL-dump would be better.
    – Zaz
    Aug 31 '10 at 13:05

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.