/tmp/mysql.sock not found

vijai

Verified User
Joined
Jul 22, 2013
Messages
24
Hello all,
After my last problem is solved, I'm facing anew one related to the last. While trying to create a db in user level, I get
Code:
Error connecting to MySQL: Can't connect to local MySQL server through socket '/tmp/mysqld.sock' (2)
But it does exist in tmp! And phpmyadmin works fine and so does the forum hosted on the server. I also found that there was no my.cnf in /etc/ so I added one myself. And I'm scared of restarting mysql if it would start fine or not. How do I solve this error?
Regards
Vijai
 
why you change the /etc/my.cnf ?
by default it's on /var/lib/mysql

please provide me the
/etc/my.cnf file


thanks
 
I had my.cnf in /etc/mysql symlinked /etc/my.cnf. So I created a new my.cnf in /etc/ The contents are:
Code:
[mysqld]
local-infile=0
socket=/tmp/mysql.sock

[client]
socket=/tmp/mysql.sock

And today I restarted mysqld and it said there is already a mysqld_safe process running.
How do I solve?
Edit: found that the socket name is actually mysql.sock in /tmp but DA always looks for mysqld.sock . Where and how do I change the name?

Edit2: Just changed the socket to /tmp/mysqld.sock and the problem in DA is over. It detects mysqld.sock but my forum no more works and it says "unexpected database error occured" And also my other php scripts that connect to mysql localhost!

Thank you
 
Last edited:
Hello,

why you change the /etc/my.cnf ?
by default it's on /var/lib/mysql

Debian and CentOS are different in their way to place mysql.sock. And on Debian the socket file is located exactly in /tmp/ by default: /tmp/mysql.sock

It detects mysqld.sock but my forum no more works and it says "unexpected database error occured" And also my other php scripts that connect to mysql localhost!

Please make check php.ini and see what values you have there for the followings:

Code:
pdo_mysql.default_socket=

mysql.default_socket =

mysqli.default_socket =

and restart apache. If they are not empty (that's OK if they are), make sure they point to the correct place.

And try to access MySQL tables via phpMyAdmin and fix/check them all.
 
Thank you for your help. The values for the above are empty. I feel that the DA actually looks for the wrong socket? mysqld.sock instead of mysql.sock? Because I can find mysql.sock in /tmp/ and when I change it to mysqld.sock in my.cnf, everything breaks but DA works fine. And inverse in the other situation.
 
ok what if you don't want to use the /tmp/mysql.sock location I have changed the my.conf php.ini and /usr/local/directadmin/conf/mysql.conf but it still will not work in directadmin I can use MYSQL if I use phpmyadmin or anything BUT directadmin but that doesn't help lol
 
Back
Top