LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (http://www.linuxquestions.org/questions/debian-26/)
-   -   Mysql Server error Can't connect to local MySQL server through socket (http://www.linuxquestions.org/questions/debian-26/mysql-server-error-cant-connect-to-local-mysql-server-through-socket-441813/)

sridhar11 05-05-2006 03:46 AM

Mysql Server error Can't connect to local MySQL server through socket
 
Hi Guys,

I am getting very starange error with Mysql and bacula backup

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
05-May 08:34 backup1-dir: *Console*.2006-05-05_08.29.18 Fatal error: sql_get.c:277 sql_get.c:277 query SELECT VolSessionId,VolSessionTime,PoolId,StartTime,EndTime,JobFiles,JobBytes,JobTDate,Job,JobStatus,Type,L evel,ClientId FROM Job WHERE JobId=237 failed:


I have checked the error message Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

I am using Debisn sarge with mysql version 4.0.24 there seems to be bug reported for this

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=321578

When i went in to the file /etc/mysql/my.cf i couldn't find the 'old_passwords = 1' what every one suggests.

My my.cf file as follows

Quote:


[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 128K
#
# * Query Cache Configuration
#
query_cache_limit = 1048576
query_cache_size = 16777216
query_cache_type = 1
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
#log = /var/log/mysql.log
#log = /var/log/mysql/mysql.log
#
# Error logging goes to syslog. This is a Debian improvement :)
#
# Here you can see queries with especially long duration
#log-slow-queries = /var/log/mysql/mysql-slow.log
#
# The following can be used as easy to replay backup logs or for replication.
#server-id = 1
log-bin = /var/log/mysql/mysql-bin.log
# See /etc/mysql/debian-log-rotate.conf for the number of files kept.
max_binlog_size = 104857600
#binlog-do-db = include_database_name
#binlog-ignore-db = include_database_name
#
# * BerkeleyDB
#
# The use of BerkeleyDB is now discouraged and support for it will probably
# cease in the next versions.
skip-bdb
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Feature
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# If you want to enable SSL support (recommended) read the manual or my
# HOWTO in /usr/share/doc/mysql-server/SSL-MINI-HOWTO.txt.gz
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem

[mysqldump]
quick
quote-names
max_allowed_packet = 16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer = 16M

I am really not sure this is related to mysql or bacula related error i am gussing problem could be mysql side.

One more thing also when i get this error message i can see mysql server is running and i can stop and start mysql server without any problem

I need expert advise here with mysql

Thanks for your help

jschiwal 05-05-2006 05:47 AM

One thing that can cause that problem is if you haven't started the mysqld service.

sridhar11 05-05-2006 06:48 AM

thanks for your reply.I can confirm mysqld is running

ps -ef | grep mysqld
root 951 1 0 09:00 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe
root 987 951 0 09:00 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe
mysql 988 987 0 09:00 ? 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
root 989 987 0 09:00 ? 00:00:00 logger -p daemon.err -t mysqld_safe -i -t mysqld
mysql 990 988 0 09:00 ? 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
mysql 991 990 0 09:00 ? 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
mysql 992 990 0 09:00 ? 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
mysql 993 990 0 09:00 ? 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
mysql 994 990 0 09:00 ? 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
mysql 995 990 0 09:00 ? 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
mysql 996 990 0 09:00 ? 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
mysql 997 990 0 09:00 ? 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
mysql 998 990 0 09:00 ? 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock

thanks

jschiwal 05-05-2006 11:43 PM

One difference I noticed is that your my.cnf file says "socket = /var/run/mysqld/mysqld.sock"
Mine says "socket = /var/lib/mysql/mysql.sock"
Check if the directory /var/lib/mysqld/ exists and not /var/lib/mysql/

Also, a twist on my original question. Maybe rather than the mysql server not running, you are trying to start a second server, and that socket is already being used. Do you know that the "(2)" at the end of the first line of the error message stands for?

Also, check the manual at "/usr/share/doc/packages/mysql/manual.pdf"
Perhaps there is something in there I didn't notice.

cleopard 05-21-2008 05:26 PM

I'm also getting:

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)


and even though I've gone through and installed 'mysql', I don't see file 'mysqld.sock' anywhere. Did I miss something, something that I didn't install yet? Any help would be great?

jstephens84 05-21-2008 08:17 PM

Not sure if this is still an issue for you guys but I just installed mysql and found that my my.cnf file has the socket going to /var/run/mysqld

what do you get from the mysql shell when you type select version(); or from the linux shell mysql --version ?

cleopard 05-22-2008 08:20 AM

I have the directory /var/lib/mysql instead of /var/lib/mysqld as was mentioned in a previous post. I installed this a week ago on a different machine and it has the "mysqld" directory as it should and I can't think what I missed this time. Are the mysqld.* files created during the "apt-get install snort-mysql" process?

dused_finch 08-29-2010 07:06 PM

MySQL connect ERROR
 
having problems with this one lately..
what should be done in order to fix this..need help...
we are currently using vicidial VERSION: 2.0.5-173
BUILD: 90320-0424

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

quanta 08-29-2010 09:32 PM

ps -ef | grep mysqld?
cat /path/to/my.cnf?

jstephens84 08-31-2010 07:10 PM

@dused_finch

a few things come to mind. Normally this happens when you have don't have the mysql daemon started. most distros you can start it by typing in
Code:

/etc/init.d/mysqld start
and that should get you going. I think it can sometimes also be that after you did your install you will need to give root a password.

Code:

mysqladmin -u root password <enter password here>
You may want to check first that the dameon is atually running by doing a
Code:

ps -ef | grep mysql

samuel.meza 07-26-2011 12:55 PM

mysqldump error
 
If mysqld is running and you still get this error, try finding what socket mysqld is runing on:

ps -aux | grep mysqld

Look for --socket=/path/to/mysql.sock


then use it as parameter on the mysqldump command:

mysqldump --socket=/path/to/mysql.sock -uXXXXX -pXXXXX database > database.sql

Hope this helps, regards.


All times are GMT -5. The time now is 03:23 AM.