mysql vs selinux

Sharpe, Sam J sam.sharpe+lists.redhat at gmail.com
Mon Jul 6 06:33:34 UTC 2009


2009/7/6 Amadeus W.M. <amadeus84 at verizon.net>:
> Trying to run mysqld with datadir=/data/mysql (i.e. different than the
> default datadir=/var/lib/mysql). When I start mysqld for the first time it
> fails:
>
> [root at alm ~]# /etc/rc.d/init.d/mysqld start
> Initializing MySQL database:  Installing MySQL system tables...
> 090705 23:01:52 [Warning] Can't create test file /data/mysql/alm.lower-test
> 090705 23:01:52 [Warning] Can't create test file /data/mysql/alm.lower-test
> /usr/libexec/mysqld: Can't change dir to '/data/mysql/' (Errcode: 13)
> 090705 23:01:52 [ERROR] Aborting
<snip>
> chcon -R -u system_u -r object_r -t mysqld_db_t /home/mysqldb
> chcon -R -u system_u -r object_r -t mysqld_db_t /var/lib/mysql/
> chcon -u system_u -r object_r -t mysqld_etc_t /etc/my.cnf
>
> with /data/mysql instead of /home/mysqldb, of course.

It might be better to do this instead of the first line:

chcon -R --reference=/var/lib/mysql /data/mysql

Lines 2 and 3 should be unnecessary if mysql works with the default
data dir already.

-- 
Sam




More information about the fedora-list mailing list