LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 07-19-2004, 05:09 PM   #1
J0sep
LQ Newbie
 
Registered: Apr 2004
Location: Chile
Distribution: Gentoo
Posts: 15

Rep: Reputation: 0
error: Can't connect to local MySQL server through socket


Hi all, if u please help me on this.
I get this error with mysql server:

mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!

Well that file isn't there...dont' know why.
I've installed mysql server within the istallation of red hat 9. And i've updated my distro but still get the same error. I need this service running to test my 'Koha' server.
If u please help me... anything, I need to know how do I get this thing working.

Also the service can start:
# /etc/init.d/mysqld start
Starting MySQL: [ OK ]

but when trying to enter with mysqladmin -u <user> and all the rest, it fails with the error above.

Please help...
Thanks,
Cheers.

jose
 
Old 07-19-2004, 06:52 PM   #2
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
Hi J0sep,
Normally this socket is on "/var/lib/mysql/mysql.sock". You may have some configuration mismatch between the server and the admin. Until you discover the mismatch, you can link it by entering
Code:
ln -s /var/lib/mysql/mysql.sock /tmp
Good luck!
 
1 members found this post helpful.
Old 07-28-2004, 06:34 AM   #3
trippccn
LQ Newbie
 
Registered: Jul 2004
Posts: 2

Rep: Reputation: 0
That actually solved a problem i've been having... could you possibly explain how i would go about finding this mismatch? I hate to leave it as a work around. I'd rather find the source of the problem.

Thanks,
Chad Arimura
 
Old 07-28-2004, 01:12 PM   #4
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
Hi trippccn,

Look at the file "/etc/my.cnf". May be you could find a divergence in the position of this socket. Mine looks as
Code:
mysql.server]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

[mysqladmin]
socket=/var/lib/mysql/mysql.sock

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

[mysql]
socket=/var/lib/mysql/mysql.sock
 
Old 07-28-2004, 02:43 PM   #5
trippccn
LQ Newbie
 
Registered: Jul 2004
Posts: 2

Rep: Reputation: 0
Hi osvaldomarques,

My cnf is as follows. I wonder why the socket is set to /var/lib/mysql directory, but the php web application that was calling the db open function was looking for the /tmp/ sock. Could it be something I'm missing when I upgraded from 3.23 to 4.0.20?

Code:
[mysqld]
default-character-set=latin1
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-innodb
     
[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Thanks a lot,
Chad
 
Old 07-28-2004, 06:14 PM   #6
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
I don't think so...
Historically all the sockets were open in /tmp, because they can be easily removed during boot up procedures. They don't need to exist when the server is not running. For a matter of security, nowadays, the things historically laid in /tmp are gaining another directories, because /tmp is accessible by all local users. The php server have a configuration, probably at "/etc/php4/apache/php.ini" where you can specify the location of the socket for php access.
 
Old 09-22-2007, 08:13 AM   #7
helpmeforlinux
LQ Newbie
 
Registered: Aug 2006
Posts: 11

Rep: Reputation: 0
Talking yum install mysql

hi i have installed mysql using command
yum install mysql

My distro is Fedora 6
and it installed it succesfully
but when i try service mysqld start it say unrecognized service.

what will be the problem can any body address in this regards.
 
Old 09-22-2007, 10:39 AM   #8
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
Probably you installed only the client package. There is a package named "mysql-server" which contains the server. For more info about the available packages, use
Code:
yum list available|grep mysql
 
Old 02-18-2008, 09:21 PM   #9
zyopensource
LQ Newbie
 
Registered: Feb 2008
Posts: 3

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

hi i have installed mysql using command
yum install mysql
My distro is Fedora 8
and it installed it succesfully
but when i try service mysqld start it say Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
the Code of /etc/my.cnf is:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Last edited by zyopensource; 02-18-2008 at 09:24 PM. Reason: I'm not finishing
 
Old 02-19-2008, 06:34 AM   #10
zyopensource
LQ Newbie
 
Registered: Feb 2008
Posts: 3

Rep: Reputation: 0
I am so happy!
I solve my error questions"Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'",because mysqld isn't run.We can find in "K menu-->setting-->service setting",if only you start mysqld ,you can input this "mysql -u root",then you can see this" mysql>".
But I don't know yours' systems ,my system is fedora 8 and I use "yum install mysql"installing mysql.
 
Old 06-27-2008, 04:54 PM   #11
falling123
LQ Newbie
 
Registered: Jun 2008
Posts: 2

Rep: Reputation: 0
This best and quickest fix I've found for this

Just restart the mysql service
sudo /sbin/service mysqld restart

that should refresh everything
 
Old 01-23-2009, 11:29 PM   #12
Brotherred
Member
 
Registered: Mar 2007
Location: Michigan
Distribution: Mandriva 2010.1
Posts: 37

Rep: Reputation: 15
mysql on Mandriva 2008.1

Hello all. I am kinda frustrated as I am really looking to get a greeting card suite working. I am thinking that some sort of data base program is how proprietary greeting card programs actually work. That would be the rational behind sticking with this attempt. It does seem that all *nix tech stuff is the base for the more closed API flavors.

I have the some of the same issues discussed in this thread but still am not sure how to handle this. This thread is dated as well.

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

So could I use the advice posted in this thread for my issue. Sorry I am pretty lost as for what to do.
 
Old 05-16-2009, 05:52 PM   #13
karthiksharu
LQ Newbie
 
Registered: May 2009
Posts: 15

Rep: Reputation: 0
httpd and mysqld difference

I got connection error to when tried to connect to mysql using mysql administrator also with 'mysql -u root'. I tried restarting httpd but cant fix it. Again I tried with 'service mysqld restart' and it worked.
Can anyone tell me whats the difference between httpd and mysqld.

Thanks a lottt
 
Old 05-16-2009, 06:13 PM   #14
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,553

Rep: Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946
Quote:
Originally Posted by karthiksharu View Post
I got connection error to when tried to connect to mysql using mysql administrator also with 'mysql -u root'. I tried restarting httpd but cant fix it. Again I tried with 'service mysqld restart' and it worked.
Can anyone tell me whats the difference between httpd and mysqld.

Thanks a lottt
Open your own thread, and ask the question. Don't hijack someone elses (old) question...that's very rude.

And you might want to try Google if you need such basic knowledge....
 
Old 08-07-2009, 05:33 PM   #15
Esswendle
LQ Newbie
 
Registered: Aug 2009
Distribution: openSUSE
Posts: 2

Rep: Reputation: 1
Quote:
Originally Posted by TB0ne View Post
Open your own thread, and ask the question. Don't hijack someone elses (old) question...that's very rude.

And you might want to try Google if you need such basic knowledge....


I came to this site as I am having a Linux software issue, but seeing this post has really put me off.


This forum describes itself as "friendly" and it's tag-line is "where Linux users come for help".


Really? someone asks a question and get's told he/she is being "rude" (as the question may have been asked in the 'wrong' place) and is advised to bugger off to google as the enquiry is deemed too "basic" to bother helping with?


I think it's clear who is really being rude.



It's quite disgraceful behaviour from someone posting on, supposedly, a help forum.

Last edited by Esswendle; 08-07-2009 at 05:41 PM.
 
  


Reply


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 17 09-17-2014 02:13 PM
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. 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
Can't connect to local MySQL server through socket . . . patpawlowski Programming 2 01-23-2004 03:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 04:08 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration