Thursday, April 20, 2017

Disabling selinux on CentOS

If you try to run MySQL with selinux running on CentOS, you will get vague permission denied error like the following. It is frustaring to figure out why MySQL will not start because it does not point to SElinux being the problem.

/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13 - Permission denied)
2017-04-20 21:01:43 20164 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create

Starting MySQL (Percona Server). ERROR! The server quit without updating PID file


rm: cannot remove `/var/lib/mysql/SERVERNAME.pid': Permission denied
 ERROR! The server quit without updating PID file (/var/lib/SERVERNAME.pid).

Check your log file to see what errors MySQL is generating during the start up process.

You can turn it off like this:

echo 0 >/selinux/enforce

Credit to:

https://www.cyberciti.biz/faq/howto-turn-off-selinux/