Can't connect '/var/lib/mysql/mysql.sock' (13) - but not the usual suspects???

Can't connect '/var/lib/mysql/mysql.sock' (13) - but not the usual suspects???

Post by sean.mole » Mon, 16 Jul 2007 23:29:30



Hello All

I'm new to Linux and am trying to learn to develop PHP and MySQL web
applications but am stuck.

I'm running Suse 10.0 and have installed Apache, PHP and MySQL from
the DVD.

Apache, and PHP are working and <?php phpinfo(); ?> produces the
expected output.

MySQL is also working and I've used knoda to create a sample database.

I'm using this php to try to connect to MySQL


$mysqluser = 'root';
$mysqlpasswd = 'mypassword123';
$mysqlhost = 'localhost';
$connID = mysql_connect($mysqlhost, $mysqluser, $mysqlpasswd);


However, when I try it I get:

Can't connect to local MySQL server through socket '/var/lib/mysql/
mysql.sock' (13) .

I've been searching the posts and understand that 13 means it is a
permissions problem. However all the reported causes I can find seem
OK on my machine.

1) MySQL is running
I've checked with mysqladmin ping and get the following

linux:~ # mysqladmin -p ping
Enter password:
mysqld is alive
linux:~ #

2) SELinux is disabled

I used usr/sbin/setenforce Permissive and now /usr/sbin/getenforce
says 'Disabled'

linux:~ #

3) mysql.sock is where I'd expect it to be with the expected mysql
owner, mysql group and expected permissions. I tested this like so.

linux:~ # ls -l /var/lib/mysql/mysql.sock
srwxrwxrwx 1 mysql mysql 0 Jul 15 13:54 /var/lib/mysql/mysql.sock
linux:~ #


4) /var/lib/mysql/ has the expected mysql owner, mysql group and
expected permissions. I tested this like so.

5) /var/lib/mysql/ has the expected mysql owner, mysql group and
expected permissions. I tested this like so.

linux:~ # ls -l /var/lib/

......(omitting lines here)

drwxrwxrwx 7 mysql mysql 520 Jul 15 13:54 mysql

......(omitting lines here)

linux:~ #

6) I included myself in the mysql group.

Clearly, I am missing something but I don't know what.

My guess is it is something silly and simple, but it beats me. Any
help anyone can give would be greatly appreciated.