Today, while I was trying to access MySQL through PHP on HTTPD Apache server, I was getting a connection fail. Since I installed PHP for the first time, I double checked on whether I had installed the PHP-MySQL module as well. Yes, I had, all seemed to be fine… but… try again… hey a yellow asterisk pops-up in my task-bar… SELinux is preventing httpd to access MySQL.
What now? Followed the link to the FAQ:
I am summarising it as follows:
Copy the ‘raw message‘ which appears at the end of the SELinux service denied screen. Save it as selinux_httpd_mysql_alert.txt, and run the following command.
audit2allow -M local < selinux_httpd_mysql_alert.txt
This will generate a file called local.pp. Load this by either running the command
semodule -i local.pp
Or by going to the SELinuxManagement [from the System menu -> Administration] and then do a load policy.
Thats simple alt=title=”:)” />.