LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 05-05-2006, 03:46 AM   #1
sridhar11
Member
 
Registered: Dec 2002
Location: us
Posts: 108
Blog Entries: 321

Rep: Reputation: 15
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
 
Old 05-05-2006, 05:47 AM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
One thing that can cause that problem is if you haven't started the mysqld service.
 
Old 05-05-2006, 06:48 AM   #3
sridhar11
Member
 
Registered: Dec 2002
Location: us
Posts: 108
Blog Entries: 321

Original Poster
Rep: Reputation: 15
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
 
Old 05-05-2006, 11:43 PM   #4
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
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.
 
Old 05-21-2008, 05:26 PM   #5
cleopard
Member
 
Registered: May 2006
Posts: 39

Rep: Reputation: 15
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?
 
Old 05-21-2008, 08:17 PM   #6
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043

Rep: Reputation: 83
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 ?
 
Old 05-22-2008, 08:20 AM   #7
cleopard
Member
 
Registered: May 2006
Posts: 39

Rep: Reputation: 15
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?
 
Old 08-29-2010, 07:06 PM   #8
dused_finch
LQ Newbie
 
Registered: Aug 2010
Posts: 1

Rep: Reputation: 0
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)
 
Old 08-29-2010, 09:32 PM   #9
quanta
Member
 
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 100Reputation: 100
ps -ef | grep mysqld?
cat /path/to/my.cnf?
 
Old 08-31-2010, 07:10 PM   #10
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043

Rep: Reputation: 83
@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
 
Old 07-26-2011, 12:55 PM   #11
samuel.meza
LQ Newbie
 
Registered: Jul 2011
Posts: 1

Rep: Reputation: Disabled
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.
 
  


Reply

Tags
mysql, mysqlsock


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock welery Linux - Software 19 03-06-2014 07:19 AM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 16 12-10-2012 02:34 AM
error: Can't connect to local MySQL server through socket J0sep Red Hat 20 07-13-2011 09:32 AM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. suziecorbett Linux - Software 8 10-09-2008 01:52 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM


All times are GMT -5. The time now is 07:59 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration