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.
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.
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
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)
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.
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.
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.
Let's start that lamapper already seemed to have found his solution (see post #8).
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.
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