Bug #40094 Allow group read/write/execute at filesystem on database create
Submitted: 16 Oct 2008 22:59 Modified: 4 Feb 2009 10:29
Reporter: Dimitriy A Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: DDL Severity:S4 (Feature request)
Version:5.1 OS:Linux
Assigned to: CPU Architecture:Any
Tags: create database, file system, GROUP, permission

[16 Oct 2008 22:59] Dimitriy A
Description:
When creating a new database in MySQL server, a directory is created at file system level. By default that directory gets 700 permissions, meaning the owner has full privileges (read/write/execute), but the group and others don't. It would be more beneficial if the directory gets 770 permission, so that group has full access to it as well.

In our environment, database administrators and certain application users are part of dba group. MySQL is also part of dba group. When a database is created, anyone who is assigned to dba group cannot access the new directory. If there was access to the new directory, it would be very useful for file system level backup scripts and other reasons as well. Otherwise, we have to manually change the permission on any newly created databases.

How to repeat:
mysql> create database db;
mysql> quit;

datadev1:/mysql_01> ll | grep daa
drwx------  2 mysql dba        72 2008-10-16 15:56 daa

Suggested fix:
Set permissions to 770 for newly created database, so it would be like the following:

mysql> create database db;
mysql> quit;

datadev1:/mysql_01> ll | grep daa
drwxrwx---  2 mysql dba        72 2008-10-16 15:56 daa
[16 Oct 2008 23:54] Dimitriy A
I put in the wrong database name in examples. Here is how it is suppose to be.

How to repeat:
mysql> create database db;
mysql> quit;

datadev1:/mysql_01> ll | grep db
drwx------  2 mysql dba        72 2008-10-16 15:56 db

Suggested fix:
Set permissions to 770 for newly created database, so it would be like the following:

mysql> create database db;
mysql> quit;

datadev1:/mysql_01> ll | grep db
drwxrwx---  2 mysql dba        72 2008-10-16 15:56 db
[4 Feb 2009 10:29] Hartmut Holzgraefe
This behavior can be controlled on server startup using the 
UMASK and UMASK_DIR environment variables, see also the manual 
section on "Problems with File Permissions":

   http://dev.mysql.com/doc/refman/5.1/en/file-permissions.html