Can't connect to local MySQL server through socket

moldtw

New member
Joined
Dec 24, 2005
Messages
1
Can't use MYSQL

ERROR message below:

Error connecting to MySQL: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
 
Help : Error connection

hi,

i am facing the same problem when i click on MySQL management in Direct Admin:

Error connecting to MySQL: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

however my web applications can still access the database and are running fine.

What should i do? Thanks.
 
I am facing the same problem. I am running DA 1.28.0 on Debian 3.1. Alle websites are using mysql without problems, but when i go to MySQL Management in DA then the following error is shown and i cannot add/change/remove a database:

Error connecting to MySQL: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

There is nothing on the server called 'mysql.sock'. I have another server that doesnt have this problem and is also running DA 1.28.0 on Debian 3.1. It doesn't have a mysql.sock file neither but on that one i can access the MySQL Managment in DA without the error and it works properly.

Server with problem:
Code:
server02:~# locate mysql.sock
server02:~#

server02:~# ps -e | grep mysqld
17013 ?        00:00:00 mysqld_safe
17036 ?        00:00:00 mysqld
17037 ?        00:00:00 mysqld
17038 ?        00:00:00 mysqld
17039 ?        00:00:00 mysqld
17040 ?        00:00:00 mysqld
17041 ?        00:00:00 mysqld
17042 ?        00:00:00 mysqld
17043 ?        00:00:00 mysqld
17044 ?        00:00:00 mysqld
17045 ?        00:00:00 mysqld
 5720 ?        00:00:00 mysqld
Server without the problem:
Code:
server01:~# locate mysql.sock
server01:~#

server01:~# ps -e | grep mysqld
 6935 ?        00:00:00 mysqld_safe
 6958 ?        00:00:00 mysqld
 6959 ?        00:00:00 mysqld
 6960 ?        00:00:00 mysqld
 6961 ?        00:00:00 mysqld
 6962 ?        00:00:00 mysqld
 6963 ?        00:00:00 mysqld
 6964 ?        00:00:00 mysqld
 6965 ?        00:00:00 mysqld
 6966 ?        00:00:00 mysqld
 6967 ?        00:00:00 mysqld
 7224 ?        00:00:00 mysqld
 7386 ?        00:00:00 mysqld
 7464 ?        00:00:00 mysqld
 8123 ?        00:00:00 mysqld

Does anyone have a solution to this problem? Maybe DA Support?

Thanks
 
Ok well i have found the solution to the problem as well. But i still don't know how it occured.

When i stopped the mysqld daemons my website showed this:

Warning: mysql_pconnect() [function.mysql-pconnect]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

So it seems the socket is in /tmp instead of /usr/lib/mysql.
So i edited /usr/local/directadmin/conf/mysql.conf and changed the first line from

Code:
socket=/usr/lib/mysql/mysql.sock
to
Code:
socket=/tmp/mysql.sock
and the problem was fixed.

Does anyone know how this could have been changed, because it worked before!
 
Back
Top