MySQL error "Can't connect to...socket '/tmp/mysql.sock' (2)


Subject: MySQL error "Can't connect to...socket '/tmp/mysql.sock' (2)
From: James McMorris (buddha@gci.net)
Date: Mon Mar 04 2002 - 03:00:26 AKST


I'm new with MySQL and I'm getting an error on my first attempt at
using it with a php script I downloaded
(http://www.seattleserver.com/httpfs.htm). I need to know what .sock
files are/do and how to fix this error. I have recently installed the
latest PHP rpm for RH 7.2 on my system as it fixes some remote
exploits. I hope this isn't causing me the .sock problem.

The error on the web page is: "Warning: Can't connect to local MySQL
server through socket '/tmp/mysql.sock' (2)
in /var/www/html/fileexchange/mysqlinterface.php3 on line 45
Unable to connect to localhostCan't connect to local MySQL server
through socket '/tmp/mysql.sock' (2)"

The code in question on line 45 is:
function dbi_connect($dbhost, $dbusername, $dbpassword, $dbdatabase,
$dbport){
     mysql_pconnect($dbhost, $dbusername, $dbpassword)
       or die("Unable to connect to " . $dbhost . mysql_error());

A mysql.sock file is located at /var/lib/mysql/mysql.sock

I've left the MySQL config file /etc/my.cnf at defaults as follows:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

I used webmin to create a user with wide open permissions on everything
within MySQL to to avail. Same for user 'root'.

Any ideas?

-Jim "Buddha" McMorris



This archive was generated by hypermail 2a23 : Mon Mar 04 2002 - 03:00:30 AKST