[Cialug] Mysql connection problem

Jeffrey Ollie jeff at ocjtech.us
Fri Apr 11 14:50:16 CDT 2008


On Thu, Apr 10, 2008 at 4:09 PM, Deepan <codeshepherd at gmail.com> wrote:
> Hi All,
>  I am able to connect to Mysql via command line
>  using mysql client. I am also able to connect to
>  mysql via php if I run those php programs via
>  command line. However when I hit those php pages
>  via the browser it throws the error Can't connect
>  to local MySQL server through socket
>  '/tmp/mysql.sock' (2). Please note that this is
>  the same socket the mysql client tries to connect
>  to the server.

What system are you running this on?  It may be SELinux blocking the
connection.  Try something like:

# getsebool httpd_can_network_connect_db
httpd_can_network_connect_db --> off

And to change it:

# setsebool -P httpd_can_network_connect_db on

Jeff


More information about the Cialug mailing list