ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysq
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
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.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysq
i got this error message when i start mysql. i just installed SUSE 10 pro and installed apache2 and mysql as package selected installation. whenever i type mysql and hit enter i got this message. im very frustrated, i've been looking around at forums for many hours but cant seem to find an answer. i've tried many methods of solutions from experts but still cant work. this is the exact error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
please help, i need to start on a PHP project soon. thank you in advance to the linux community
i turned off my firewall (just in case it is blocking port 3306) and typed mysqld_safe and it shows this message after i hit enter:
linux:/ # mysqld_safe
Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/lib/mysql/linux.site.pid
060407 10:46:35 mysqld ended
linux:/ #
immediately i see the line "mysqld ended". what do you think is wrong? does it mean the mysql daemon is not started? please help im getting really frustrated!! peace to the OSC...
ERROR 2002 (HY000): Can't connect to local MySQL server... error still alive and well
I too encountered this problem after attempting to reset MySQL's “root” password on my home server.
So sadly this error is alive and well, if people find a solution, they do not seem to come back and report what it was. Makes me wonder if they just gave up. Note a few people gave up on resetting the MySQL “root” password also, stating that only a reinstall of MySQL and MySQL server fixed the problem for them. Chances are they made sure to write down what their new MySQL root password was this time. I will make sure to come back and post a solution when I have one, since no one else has posted anything definitive on this error message that I can find and I have looked on this site, forums and the MySQL home site as well as a few others.
Here is the exact error message I got when I attempt to start the MySQL server from a terminal as root. This is after supposedly resetting MySQL's root password (which I later determined did NOT work)
root@servername:/var/run/mysqld# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
Not only did the MySQL 'root' password NOT get reset(not covered here), but I had to shutdown, power off and power on the server in order to get mysql (mysqld) running again.
I was able to get into mysql mode on the server ONLY with
root@servername#mysql -u user
Not that it does you any good as the MySQL 'root' user password has not been changed.
Note: Many people have mentioned potential firewall / router issues as well, so I will bear this in mind, but will look for other solutions before I set up special connections through my firewall / router.
This worked for me, hopefully it will for you. Note: I had performed many of the other methods prior to this example. However after rebooting the server, when MySQL came up I was unable to login from another PC via a terminal window and SSH session as any MySQL users other than the default user (mysql -u user). Of course that user is available for everyone by default.
Still this is frustrating when you want to learn more, go in and see as much of the inner workings as you possibly can. The only time I could actually login to the server with any account other than -u user, was when I used the "--skip-grant-tables" option.
For everyone who has been frustrated and unable to get these steps to work here is the URL that finally worked for me, hopefully it will for you as well:
I would try the above FIRST, if it works you are good to go at least I hope you will be.
Note for newbies: The MySQL documentation can be found here: http://dev.mysql.com/doc/refman/4.1/...anagement.html Note: that many of the commands listed here may not work for ubuntu and debian users. Not really sure why, perhaps the commands are geared toward CentOS and Redhat versions of MySQL...? FYI, Here are some examples (see 5.6.2. Adding User Accounts at the mysql.com website):
mysql --user=root mysql does not work on ubuntu (probably not debian either)
mysql --user=root -p does not work on ubuntu
mysql -u root -p does work (on ubuntu) after you successfully reset the password in the step above. This form will prompt you for the password to MySQL's root account.
Not really sure why, perhaps the commands are geared toward CentOS and Redhat versions of MySQL...?
No. The instructions in the reference manual are the instructions for 'standard' installs.
Unfortunately, Ubuntu (and possibly Debian) don't do standard installs.
This error is alive and well becuase it's massively generic, and says so little about which one of the many problems it could acutally be. Please don't drag up dead threads in future.
Distribution: openSUSE 10->11.2, fedora 8->11, CentOS 5+, et al
Posts: 6
Rep:
Quote:
Originally Posted by acid_kewpie
This error is alive and well becuase it's massively generic, and says so little about which one of the many problems it could acutally be. Please don't drag up dead threads in future.
People are obviously still looking for advice, what harm is it if an old thread gets some new activity?
I've never understood why mods bother saying crap like this...
[that's not an "insult", no ad hominim, just a general observation]
^ this thread addressed the real issue for me- I've never used mysql just because postgresql is just so awesome I've never had to. but I ran into this when installing from source on Fedora 11.
Last edited by weaponsofwar; 09-28-2009 at 03:50 AM.
Reason: new information...
Why becuase someone will start trying to solve the original problem, posed over then 3 years ago, wasting there time for no benefit.
Feel free not to insult mods btw. What interest is it of yours anyway? None of the comments I made related to you personally at all.
Well it does apply to me, as I was the one that drug up the old thread... (no insults were intended than or now)
Obviously I was unable to find a solution and I did search (for multiple hours) for one. No joy. I would not have bothered posting in the first place if I did not search without success first. Just the way I roll.
It is extremely frustrating to search thread after thread after thread, looking for the solution and see so many threads that appear to be related, yet have either no solution or it seems like the person looking gave up. This was my experience while searching for a solution to this particular problem.
Obviously if I found THAT thread, others will too. I too do not see the harm in attempting to post a solution or a link to a solution in order to help others I know will be looking. I know they will be looking because I was looking without success, it is that simple.
A suggestion, instead of stating "Please don't drag up dead threads in future." how about posting the link to one or many of the solutions you know about and the poster obviously does NOT know about. That would be extremely helpful, usually the mod of any forum will know about links that the person looking has no clue about. I love it when someone posts all the related links to possible solutions so I can go through them to see which one applies to my configuration.
One of the biggest problems with all the forums and wikis that I encounter is that the search mechanism does not seem to do an adequate job of bringing up many of the possible related threads, much less all of the threads. My guess is that the framework from which the forum or wiki was built was somehow limiting, thus the search tool does not catch enough, suggest enough or find all the threads that are related to a specific problem. Especially if you do not search on the magic golden hidden un-thought-of, special keyword(s) that will bring up many of those threads. It should be more than dumb luck of selecting the "right" search term.
Given the capabilities of all the SQL platforms today, especially the ability to rapidly search text based content within databases extremely rapidly, why more possible threads are not captured in any search is beyond me. I know its not the database engine limiting this, yet I did not see all the solutions you have alluded to?
Based on your response about not digging up old threads, I would not be surprised if a forum or wiki did not search "deep" enough through the threads in order to prevent dragging up a post considered too old. That would be sad if that 'old' post had the solution in it, wouldn't it.
And if someone sees a thread without a solution, I definitely do not see the harm in trying to provide one. How can that be construed as anything but helpful to everyone? I have never gotten that either. I don't give a rat's how old a thread is, I am only interested in a solution to the problem. If that comes from an 'old' thread GREAT.
I wish everyone that posted a problem would come back on line and post their solution, a link to the solution, what not to do, something, anything, however we all know that does not always happen. It did not happen in this case either, no surprise there.
What is insulting and more frustrating is when a thread is closed without a solution or link to the solution. How can a problem ever be closed without offering a solution. How does that make any sense? Even if the solution to the problem is that there is not a solution. I am not saying that I have encountered that here, just a thought that entered my mind as I wrote this. I know I have seen this on other forums and wikis on the net in the past.
Distribution: openSUSE 10->11.2, fedora 8->11, CentOS 5+, et al
Posts: 6
Rep:
Quote:
Originally Posted by acid_kewpie
Why becuase someone will start trying to solve the original problem, posed over then 3 years ago, wasting there time for no benefit.
Feel free not to insult mods btw. What interest is it of yours anyway? None of the comments I made related to you personally at all.
@acid_kewpie
this information is still relevant - some of the routines in the current mysql source date back to 2003 - that means that people could be experiencing bugs that have some history behind them.
You shouldn't be a mod If you took any offense at that at all. I didn't insult you. I just thought you posted a useless reply, are there any other more temperate mods on here I can report you to?
also I'm assuming you have some expertise on this subject - do you have any suggestions on where to start looking for some answers for this dilemna? the idea behind forums being to *help* people.
@lamapper
I found this which seems to lead in the right direction.
@lamapper
It's often better to start a new thread than to call up an old one. Just indicate that you did search and what did not seem to apply. I agree that it's frustrating to go through a big number of threads without finding the answer, but that's the disadvantage of so much info available.
@weaponsofwar
Let's start that lamapper already seemed to have found his solution (see post #8).
Quote:
I've never understood why mods bother saying crap like this...
That is what offended acid_kewpie and it would have offended me as well.
And the way you wrote your last post, you very subtle keep on insulting acid_kewpie; at least that is how I read it.
And please try not to bother other users with conflicts between yourself and mods; you should be able to contact mods directly via a private message.
If you don't come right, you can contact jeremy.
PS
you've done it, I did not want to get involved but now I am
Last edited by Wim Sturkenboom; 09-17-2009 at 01:24 PM.
Reason: added PS
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.