For Linux and other Unix-like platforms:
mysqlbackup does not record file ownership or
permissions of the files that are backed up. To ensure no file
permission issues prevent a server to be backed up, restored,
and restarted successfully, it is highly recommended
that you run mysqlbackup with the same OS user who runs the
MySQL server (typically mysql
). If
that is not possible, pay attention to the following guidelines:
For backups, mysqlbackup should be run by a user that can read all the server files and directories and can execute all server directories. To satisfy that requirement, the OS user that runs mysqlbackup should, for example, have the group owner of the server files and directories (typically
mysql
) as its primary group or secondary group.For restores, unless mysqlbackup is run by the same user that runs the server, it can be very hard to ensure that the server has access to all the restored server files and folders, especially in the case of an online restore, where the server must be able to access the files immediately after they are restored. For an offline restore, you might need to, for example, set a
umask
to the user before the restore and adjust the permissions of the restored files and folders using a series ofchmod
andchown
commands, so that the original permissions for the backed-up files and folders are reproduced.