Relationship between MySQL mysqld file generation permission and UMASK
Today, because of the binlog File Permission issue, the final tracking is that the MySQL installation initialization specifies the permission for the MySQL user to generate the file, so the problem is recorded and summarized:
1. By default, the directory generated by the mysqld program has the UMASK value of 0700, And the File Permission of UMASK is 0660.
[Mysql @ localhost ~] $ Ll/export/servers/data/my3306/data/test/-ld
Drwx ------. 2 mysql root 4096 June 10 11:19/export/servers/data/my3306/data/test/# directory 0700
[Mysql @ localhost ~] $ Ll/export/servers/data/my3306/binlog/-ld # object 0660
-Rw ---- 1 mysql myinstall 150 September 24 15:12 mysql-bin.000019
-Rw ---- 1 mysql myinstall 150 September 24 15:12 mysql-bin.000020
If you want to modify the permission of mysqld to generate a file, add the environment variable to. bash_profile. bashrc of mysql.
Export UMASK = 0600 # Or the decimal value = 384. If it starts with 0, it is octal.
Export UMASK_DIR = 0750
After modification:
[Mysql @ localhost ~] $ Ll/export/servers/data/my3306/data/hhl-ld
Drwx -- x --- 2 mysql myinstall 4096 September 24 15:34/export/servers/data/my3306/data/hhl [mysql @ localhost ~] $ Ll/export/servers/data/my3306/binlog/-l
-Rw ------- 1 mysql myinstall 450 September 24 15:34 mysql-bin.000025 #0600
-Rw ------- 1 mysql myinstall 188 September 24 15:34 mysql-bin.000026
Summary: The UMASK and the system umask are not meanings. Do not confuse them. The UMASK variable controls the permissions generated by the file. Be sure to select the appropriate permissions in the mysql permission minimization control.
-------------------------------------- Split line --------------------------------------
Install MySQL in Ubuntu 14.04
MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF
Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL
Build a MySQL Master/Slave server in Ubuntu 14.04
Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS
Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04
MySQL-5.5.38 universal binary Installation
-------------------------------------- Split line --------------------------------------
This article permanently updates the link address: