From a bug report I got:
Today, I ran up2date to update to php 4.06. After updating, all mysql db
functions would not work. After investigation, I found it was due to the
new mysql server placing it's .sock file at /var/lib/mysql/mysql.sock
instead of /tmp/mysql.sock, where PHP expects it.
I corrected this issue by placing the following line in /etc/php.ini:
mysql.default_socket = /var/lib/mysql/mysql.sock
I believe this is caused due to a configuration problem with the recent
build of mysql that was installed.
I have not modified the system or used any software or packages from any
other source than redhat itself.
This upgrade also appears to break PEAR support. Packages depening
on PEAR for abstracted database calls break (such as PHPnuke). See
pear.php.net for info on PEAR.
*** This bug has been marked as a duplicate of 60515 ***
you could try changing my.cnf in /etc. If php changes the default it is probably
changing that file. If that file doesn't exist (you've probably set it up wrong
then, it should exist) copy your desired my.cnf file from
path-to-mysql/support-files to /etc then rename it to my.cnf (it will originally
be called my-large.cnf or my-small.cnf or a few others).
Then open it up and right near the top it should have a couple of socket
settings. Change them all back to /tmp/mysql.sock if they are different.
If they aren't different because you just copied that file from the
support-files directory then restart your mysql server and it should work.