I've a server with CentOS 6.3 and Mysql installed on.
I've created two partition, one for system and the bigger one for data mounted in /data
Right after installed Mysql I've created the dir /data/mysql then as root I changed the selinux context of this folder typing
chcon -R -t mysqld_db_t /data/mysql and modified the Mysql configuration file (my.cnf) to this:
[mysqld] datadir=/data/mysql socket=/data/mysql/mysql.sock user=mysql symbolic-link=0 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
but now i can't start mysqld service! It give me Can't change dir to /data/mysql (errcode 13)
This is the output of the
ls -Z /data | grep mysql:
drwxr-xr-x. mysql mysql system_u:object_r:mysqld_db_t:s0 mysql
The strange thing is that every time I try to start the mysqld service and it fails the context of myslq dir become
system_u:object_r:default_t:s0 and two dirs (mysql and test) are created in it.
Anyway if I disable selinux evreything works great....