How to deny connections to localhost and force to use FQDN instead
As always, a few minutes after posting a question, I found the answer myself. The issue was SELinux. It was set on enforced; permissive made it work instantly. Now I'll have to figure out a way to make it work with the enforced mode.

The following appeared in the audit.log:


  type=AVC msg=audit(1429781752.260:6738): avc:  denied  { name_connect } for  pid=40354 comm="httpd" dest=3306 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:mysqld_port_t:s0 tclass=tcp_socket