I moved the data directory for MySQL to an ecryptfs encrypted folder. When I run service mysqld start as root, the service will not start.
[Warning] Can't create test file /mysql/ip-172-31-29-184.lower-test
^G/usr/sbin/mysqld: Can't change dir to '/mysql/' (Errcode: 13 - Permission denied)
When it used to start before my encrypting the folder
ls -lZ /mysql outputs
drwx------. mysql mysql unconfined_u:object_r:mysqld_db_t:s0 mysql
now
ls -lZ /mysql outputs
drwx------. mysql mysql system_u:object_r:ecryptfs_t:s0 mysql
I think the issue is with how I mounted the encrypted directory.
mount -t ecryptfs /mysql /mysql
mount outputs
/mysql on /mysql type ecryptfs
(rw,ecryptfs_sig=6860c372da7bc418,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_unlink_sigs)
I am running Red Hat Enterprise Linux Server release 6.6 (Santiago), MySQL 5.6.22
Any advice is appreciated. Thank you for your help in advance.
mysqld_db_t
and after encryption this is gone. Instead of itecryptfs_t
is present. Try turning selinux off or better - set it temporarily into permissive mode withsetenforce 0
. If mysql starts, check selinux logs what it is complainging about.