I just made a php module with mysql support and had the couldn't connect
to /var/lib/mysql/mysql.sock problem. Not looking at the basics as the
RedHat 7 did the mysql install I figured it was more in mysql or php
config. I checked out the archive for this list and found a fair number
of people with the same ailment, but no solution. However, one person
who made a link to /tmp/mysql.sock shed the light I needed.

Back to the basics. A number of helpful people pointed out that you need
to make sure that mysql.sock is there. But that's just a small piece of
it. Not only must it exist, but it must be usable by the user trying to
connect to it, and therefore must be findable by that user.

The apache owner (whomever you have it configured to) is probably
different than the mysqld (and mysql.sock) owner. In my RedHat 7 setup
the user mysql owns mysql.sock. So first issue is is mysql.sock readable
by the apache owner. In my case the answer was yes - it's a socket. The
next issue is is mysql.sock findable by the apache user. No!
/var/lib/mysql was set to 700. My apache user had no execute privilege
on that directory so it couldn't "get into" the directory to use the
socket. You'll notice that almost all other directories in /var/lib are
755. Change /var/lib/mysql to 755 and you're good to go.

The reason the link from /tmp worked is that /tmp is executable
(searchable since it's a directory) by world.

How do we acquire wisdom along with all these shiny things? -David Brin

    PGP public key:     http://www.knotworks.com/wdt_pgp_pubkey.asc
    fingerprint:   DC 80 E4 18 E2 CB AC F4  8C 59 9B 9C BB A2 D7 4B

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to