Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
09-30-2004, 06:48 AM
|
#1
|
Member
Registered: Nov 2003
Distribution: Debian, SuSE,Ubuntu
Posts: 38
Rep:
|
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.
Hi
I have installed mysql, using YAST and trying to issue basic commands. But I always get the following error messege.
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
I did check the "/var/lib/mysql/mysql.sock" file but it wasn't there. This can be my problem. However I have no idea how I could re-create the myssql.sock file. Can someone help me please?
Thank you in advance.
NoviceW
|
|
|
09-30-2004, 10:43 AM
|
#2
|
Member
Registered: Sep 2004
Location: Worcester, MA USA
Distribution: Debian, Gentoo, Fedora FC2
Posts: 66
Rep:
|
Sounds like MySQL isn't running, try running 'mysqld_safe &' and see if that fixes things, i'm not sure where it's located on your distribution. But that works for the source release.
|
|
|
09-30-2004, 03:42 PM
|
#3
|
Member
Registered: Sep 2004
Location: Victoria, BC
Distribution: debian testing
Posts: 53
Rep:
|
I'm working with SuSE 9,1 and get the very same error!
so I'm interested too in the solution of this problem!
|
|
|
09-30-2004, 03:54 PM
|
#4
|
Member
Registered: Sep 2004
Location: Victoria, BC
Distribution: debian testing
Posts: 53
Rep:
|
thanks!
It perfectly worked!
|
|
|
01-30-2005, 07:32 PM
|
#5
|
Member
Registered: Nov 2003
Distribution: Debian, SuSE,Ubuntu
Posts: 38
Original Poster
Rep:
|
NoviceW
You can find the solution here.
http://www.linuxguide.blogspot.com/
NoviceW
|
|
|
02-21-2005, 02:35 PM
|
#6
|
LQ Newbie
Registered: Feb 2005
Posts: 2
Rep:
|
Mysql error 2002 Can't connect
I also get the error and mysqld is running. I am trying to install a mediawiki and the installation looks for the mysql.sock file in /var/lib/mysql/ directory. The file is in the /tmp/ directory. Not in the other place. I have moved it and Mysqladmin stops working I can configure it to start in a different place but it would be easier to configure the media wiki to run from the original file location /tmp/mysql.sock any help would be welcome
THanks in advance
djones@authentidate.com
|
|
|
02-21-2005, 04:42 PM
|
#7
|
LQ Newbie
Registered: Feb 2005
Posts: 2
Rep:
|
I have found a configure file that is in /etc. It has the references to where mysql and clients get there mysql.sock. the file name is my.cnf. When I configured the client to look at the /tmp/mysql.sock the application (mediawiki) finished its self configuration. So off to the races.
|
|
|
09-08-2006, 02:03 PM
|
#8
|
Member
Registered: Feb 2005
Location: Costa Rica
Distribution: Ubuntu, gOS, Debian & Slack 12
Posts: 426
Rep:
|
I don't know how it worked for you guys, but i still can't get mysql to start up again. Can somebody explain a bit more what to do exactly???
The computer shows me that exact same error that you have specified, and i am running red hat 9.
|
|
|
09-08-2006, 02:33 PM
|
#9
|
Member
Registered: Feb 2005
Location: Costa Rica
Distribution: Ubuntu, gOS, Debian & Slack 12
Posts: 426
Rep:
|
Quote:
Originally Posted by dizzutch
Sounds like MySQL isn't running, try running 'mysqld_safe &' and see if that fixes things, i'm not sure where it's located on your distribution. But that works for the source release.
|
From where do i run the mysqld_safe command? I still can't get mysql to start up?
|
|
|
05-30-2007, 04:59 PM
|
#10
|
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Rep:
|
mysql connect error 2002
Hi -
I realize this post is rather old...
but since it popped up #1 on Google, and since it's been added to several times already...
I thought I might just as well add my $0.02:
1. The error "ERROR 2002: Can't connect to local MySQL server through socket" can actually mean a couple of completely different things:
a) MySQL isn't running (in which case the socket file won't exist)
... OR ...
b) The Linux user doesn't have permissions to access the file
2. The first thing to do, of course, is to verify that mysqld is running. The previous posters discussed that at length.
3. As far as permissions, this worked for me:
a) Make sure the socket file is group "mysql":
Quote:
ls -ld /var/lib/mysql.sock =>
srwxrwxrwx 1 mysql mysql 0 May 25 13:30 /var/lib/mysql/mysql.sock
<= This might give "permission denied"
|
b) Make sure you're a member of "mysql" group
[quote] groups
users[quote]
c) If you're not, add yourself:
Quote:
usermod -G mysql USE_YOUR_NAME_HERE
<= Note the capital "G"
|
d) Finally, I had to manually set permissions on /var/lib/mysql:
Quote:
ls -ld /var/lib/mysql
drwx------ 10 mysql mysql 1024 May 25 13:30 /var/lib/mysql
<= The default permissions only allowed user "mysql": nobody else!
|
Quote:
chmod g+rwx /var/lib/mysql
ls -ld /var/lib/mysql
drwxrwx--- 10 mysql mysql 1024 May 25 13:30 /var/lib/mysql
<= After running "chmod g+rwx" and adding myself to "mysql" group, I was finally able to connect
|
|
|
|
07-07-2007, 12:10 AM
|
#11
|
LQ Newbie
Registered: Oct 2006
Distribution: CentOS
Posts: 6
Rep:
|
Quote:
Originally Posted by djones
I have found a configure file that is in /etc. It has the references to where mysql and clients get there mysql.sock. the file name is my.cnf. When I configured the client to look at the /tmp/mysql.sock the application (mediawiki) finished its self configuration. So off to the races.
|
thanks =) This was the ticket for me.
|
|
|
01-09-2008, 09:20 AM
|
#12
|
LQ Newbie
Registered: Jan 2008
Posts: 1
Rep:
|
Hi all
I'm having the same ERROR mensage with my opensuse but the problem is that I haven't this file /var/lib/mysql/mysql.sock
what can I do???
|
|
|
02-19-2008, 06:37 AM
|
#13
|
LQ Newbie
Registered: Feb 2008
Posts: 3
Rep:
|
I found this file was in /tmp/mysql.sock
Quote:
Originally Posted by _x_MaD_x_
Hi all
I'm having the same ERROR mensage with my opensuse but the problem is that I haven't this file /var/lib/mysql/mysql.sock
what can I do???
|
were you using the words"yum install mysql"installing mysql?if you were,
you can find this file in /tmp/mysql.sock.But I don't still solve this questions.
|
|
|
01-19-2009, 10:01 AM
|
#14
|
Member
Registered: Mar 2006
Location: Oxford, UK.
Distribution: Debian, Ubuntu, RHEL5, OSX
Posts: 41
Rep:
|
This link explains this perfectly:-
http://www.tech-recipes.com/rx/762/s...-tmpmysqlsock/
In short. Mysql is expecting to find the socket in a different place. You can specify its location in /etc/my.cnf
Code:
[root@localhost ~]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/tmp/mysql.sock
#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
[root@localhost ~]#
Here I have commented out the old socket location and added the new one.
It worked immediately.
|
|
|
09-05-2010, 07:55 AM
|
#15
|
LQ Newbie
Registered: Sep 2010
Posts: 1
Rep:
|
Hey guys it was a lot more easy for me to get it to work: the thing was mysql service wasn't running, so the only thing I did was:
$ service mysql start
and that was it! after that I could start myslq with no problems
I'm using opensuse 11.2
|
|
|
All times are GMT -5. The time now is 07:38 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|