However, MySQL has 700 permissions on the newly created database directory and 660 permissions on the data table file, which makes us confused. Does MySQL depend on the value set by the system? Reference
However, MySQL has 700 permissions on the newly created database directory and 660 permissions on the data table file, which makes us confused. Does MySQL depend on the value set by the system? Reference
Backup tools are limited to xtrabackup (2.0 +)
Umask is no stranger to everyone. It sets the default permission for files (directories). Generally, the permission for newly created directories is 755, and the permission for files is 644;
However, MySQL has 700 permissions on the newly created database directory and 660 permissions on the data table file, which makes us confused. Does MySQL depend on the value set by the system? Reference document: MySQL UMASK determines the database directory and file permissions by two variables UMASK UMASK_DIR. UMASK is the opposite of umask in Linux. in Linux, umask is the inverse mask of permissions, UMASK specifies the number of permissions;
You can set UMASK UMASK_DIR to set the default permissions for MySQL File Creation (MySQL needs to be restarted );
Why does MySQL need to control some variables to implement permission control (this is unknown and may be related to security )?
Precautions caused by UMASK:
Backup: When xtrabackup is used for backup, if the system user is not root or mysql, it only backs up the database directories that have the permission to access. If you do not have the permission, it will not report an error, ca (if the first database directory of the backup has no access permission, an error is reported)
Solution: Change the database directory permission to 755 or change the UMASK_DIR value;
Related reading:
Implementation of MySQL backup and recovery
Summary of three methods for MySQL backup and recovery
MySQL backup and restoration (views and stored procedures)