Red Hat Bugzilla – Bug 221085
chown -R of the mysql data directory every startup
Last modified: 2013-07-02 23:11:27 EDT
Description of problem:
The statement in the /etc/init.d/mysqld requires a significant time to execute
on every startup on servers with many mysql databases, and seems to not be
required unless there is a problem with items being created as another user:
chown -R mysql:mysql "$datadir"
Is this really necessary? Should we not fix the underlying problem (if there is
one) of items not being created by the proper user, rather than the shotgun
approach of just changing everything at every startup?
The following bug was filed in the CentOS bugs database detailing this issue as
Seems like it ought to be sufficient from a security perspective to chmod the
top directory, rather than -R every time. Will fix in next turn (but I'm not
sure when that will be for the base RHEL4 mysql release).
In addition, what happens if you are not running the server as mysql:mysql but
some other user. This causes a problem in my environment because the init
script needs to be modified to prevent this from happening. Maybe it should be
a seperate bug to read the mysql user from a config file?
If you try to run it as some other user, you'll doubtless find that everything breaks --- for one thing the
SELinux policy for mysqld will certainly not allow that. I'm uninterested in trying to support such a case.
I don't use selinux as it's not a requirement to run the OS. I imagine selinux
would break if apache ran as some other user too, but there are certainly
implementations that require it in large enterprises. In particular in
development environments we run various processes as different users. I'll
accept that not a lot of people don't do this and "uninterested" means not worth
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release. If you would like
this request to be reviewed for the next minor release, ask your
support representative to set the next rhel-x.y flag to "?".
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.