After moving my WP to my rejuvenated and software-RAIDed web server, I ran into what is apparently — owing to the googlejuice — a fairly common problem. WordPress would simply not connect to the MySQL database I have on a separate machine inside my firewall. I checked all the configuration files, even connected using the CLI client, but no dice. Then of course I fell back on the standard setenforce 0 test, which showed SELinux to be the culprit.
I haven’t done a lot of work with SELinux, but I have from time to time used system-config-securitylevel, which is a nice, simple tool for people like me who don’t have a lot of free time to learn the ins and outs of policy tuning. However, this particular server doesn’t have the graphical s-c-sl installed, nor any GUI for that matter. (The TUI version has no SELinux tuning interface.) Thankfully, smooge helped me out by reminding me about setsebool, and in particular the boolean I needed:
setsebool -P httpd_can_network_connect_db=true
I hate that so many people “solve” this problem by turning off SELinux, since it’s just so goldurned useful.