Case 2. Without any form of auth, I read the text file and do
mysql_connect($the_db_host,$the_db_username,$the_db_pass);
mysql_select_db($the_db_name);
mysql_query("select * from table");
and the server response is:
Error 2002: Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock; (111)
This really is a faq.
Mysql.sock normally lives in /tmp think RH puts it in /var/lib PHP can't find it. Might be php.ini looks in /var/lib change it there to match the location of you mysql.sock .. also .. check if mysql is running (ps ax | grep mysql). If it isn't you can't connect to it.
Bye,
B.