SELinux is preventing the httpd access by default.
Situation
While connecting mysql database from web, getting this error.
python: SELinux is preventing httpd from connectto access on the unix_stream_socket /var/lib/mysql/mysql.sock
Solution
Run below command to allow httpd in Selinux.
[root@nsk ~]# ausearch -c 'httpd' --raw | audit2allow -M my-httpd
******************** IMPORTANT ***********************
To make this policy package active, execute:
semodule -i my-httpd.pp
[root@nsk ~]# semodule -i my-httpd.pp
Hope it helps.
Situation
While connecting mysql database from web, getting this error.
python: SELinux is preventing httpd from connectto access on the unix_stream_socket /var/lib/mysql/mysql.sock
Solution
Run below command to allow httpd in Selinux.
[root@nsk ~]# ausearch -c 'httpd' --raw | audit2allow -M my-httpd
******************** IMPORTANT ***********************
To make this policy package active, execute:
semodule -i my-httpd.pp
[root@nsk ~]# semodule -i my-httpd.pp
Hope it helps.