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
sounds like you've not got mysql running. that's the answer i always give when i answer this question once a week, and i'm normally right :)
so bro how would i get mysql or mysqld up and running? really need mysql up and running pretty soon! thanks bro
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
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...
another discovery when i run the following command:
linux:/ # mysqld -u mysql
InnoDB: Error: log file /var/lib/mysql/ib_logfile0 is of different size 0 151552 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
060407 11:12:36 [ERROR] Can't init databases
060407 11:12:36 [ERROR] Aborting
060407 11:12:36 [Note] mysqld: Shutdown complete
what does these error messages mean?
The same problem
I'm having the same problem, did you solve it?
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:
http://codesnippets.joyent.com/posts/show/2038 (this method requires sudo access for one command)
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.
Unfortunately, Ubuntu (and possibly Debian) don't do standard installs.
Other solutions for Ubuntu can be found in post #12 and post #13 on http://ubuntuforums.org/showthread.php?t=27156&page=2
PS I have once tried a Ubuntu server and did not know how fast I had to go back to Slackware.
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.
I've never understood why mods bother saying crap like this...
[that's not an "insult", no ad hominim, just a general observation]
"pantsu misete morotte yoroshiku desu ka?"
^ 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.
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.
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.
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.
I found this which seems to lead in the right direction.
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).
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 :(
|All times are GMT -5. The time now is 05:01 PM.|