I have MySQL installed on CentOS (detail versions given below). My OS is a VM machine and not a physical machine, the directory
/data/mysql is a local disk (virtual). I suspect I might need to do some extra steps in a virtualized environment. This link has some information on SELinux & virtualization but not sure how to include it for MySQL.
MySQL works fine with the data directory in
/var/lib/mysql but the moment I move it to another directory on different disk it stops working. Whereas different directory on the same disk works. If I disable SELinux, MySQL works with different disk. SELinux is restricting different drive. I tried the solution given in the following two links
In particular the following two commands:
$ semanage fcontext --add --type mysqld_db_t '/data/mysql(/.*)?' $ restorecon -r /data/mysql
When I run:
$ ls -dZ /data/mysql
I get the following:
drwxr-xr-x. mysql mysql unconfined_u:object_r:mysqld_db_t:SystemLow
Still I keep getting:
/usr/sbin/mysqld: Can't change dir to '/data/mysql/' (Errcode: 13 - Permission denied)
Is there anything else I need to do?
- MySQL : mysql Ver 14.14 Distrib 5.6.14, for Linux (x86_64) using EditLine wrapper
- OS : CentOS release 6.4 (Final)