Fixing MySql’s Error, “Cant create test file /folder/data/servername.lower-test” on RedHat OS
Had a very weird error starting my MySql after im moving MySql’s data folder from /var/lib/mysql to /folder/data on my RHEL 7 Server,
2017-03-23 11:50:52 2119 [Warning] Can't create test file /folder/data/servername.lower-test 2017-03-23 11:50:52 2119 [Warning] Can't create test file /folder/data/servername.lower-test 2017-03-23 11:50:52 2119 [ERROR] /usr/sbin/mysqld: Can't create/write to file '/folder/data/servername.lower-test' (Errcode: 13 - Permission denied)
very very weird because im already change the ownership of my /folder data to mysql user, and still not working. I even chmod it to 777 for testing purpose, yet still no positive result. After a while i found out that my SELinux is blocking it, here is the command to unblock it.
[root@servername ~]# setenforce 0 [root@servername ~]# getenforce Permissive
but the commands above only configure your SELinux until reboot. If you want to make it permanent, you could use this command,
[root@servername ~]# vi /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=permissive # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted
Hope it helps others, cheers
No Comments