mysql doesn't connect to socket

uadm

Well-Known Member
May 19, 2003
92
0
156
when we configured our sites to connect to 'localhost' we get:
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

# perror 2
OS error code 2: No such file or directory
[email protected] [~]# ls -la /var/lib/mysql/mysql.sock
srwxrwxrwx 1 mysql mysql 0 Nov 24 10:50 /var/lib/mysql/mysql.sock=
[email protected] [~]# ls -lad /
dr-xr-xr-x. 23 root root 4096 Nov 7 02:27 //
[email protected] [~]# ls -lad /var
drwxr-xr-x. 26 root root 4096 Nov 20 02:11 /var/
[email protected] [~]# ls -lad /var/lib
drwxr-xr-x. 25 root root 4096 Nov 5 12:11 /var/lib/
[email protected] [~]# ls -lad /var/lib/mysql
drwxr-x--x 36 mysql mysql 4096 Nov 24 10:50 /var/lib/mysql/

how do we fix it?

Thanks.
 
Last edited:

uadm

Well-Known Member
May 19, 2003
92
0
156
[SOLVED]

This was a problem with cloudlinux's cagefs

adding /var/lib/mysql to /etc/cagefs/cagefs.mp
and running cagefsctl --remount-all
fixed the problem