6 Replies - 4427 Views - Last Post: 19 July 2012 - 06:11 AM

#1 indyarocks  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 104
  • Joined: 07-March 12

ERROR 2002 (HY000): Can't connect to local MySQL server through so

Posted 17 July 2012 - 12:06 PM

Hi All,

I was trying to create a new database in mysql, on Mac Os X. But it was giving me error as shown here . As suggested in last solution, I restarted my laptop, and now I'm not able to connect to the MySql server at all.

I'm getting following error:

static-9:~ User$ mysql -u root -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)


Please help..

Thanks,
Indy

Is This A Good Question/Topic? 0
  • +

Replies To: ERROR 2002 (HY000): Can't connect to local MySQL server through so

#2 Kruithne  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 99
  • View blog
  • Posts: 442
  • Joined: 28-July 09

Re: ERROR 2002 (HY000): Can't connect to local MySQL server through so

Posted 19 July 2012 - 01:36 AM

Could you try running through the instructions given in this article and tell me what the outcome is.
Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6078
  • View blog
  • Posts: 23,548
  • Joined: 23-August 08

Re: ERROR 2002 (HY000): Can't connect to local MySQL server through so

Posted 19 July 2012 - 04:34 AM

Kruithne, that wouldn't happen to be the first link in a Google search of the error, would it?

/sarcasm
Was This Post Helpful? 0
  • +
  • -

#4 Kruithne  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 99
  • View blog
  • Posts: 442
  • Joined: 28-July 09

Re: ERROR 2002 (HY000): Can't connect to local MySQL server through so

Posted 19 July 2012 - 04:50 AM

View PostJackOfAllTrades, on 19 July 2012 - 05:34 AM, said:

Kruithne, that wouldn't happen to be the first link in a Google search of the error, would it?

/sarcasm


So glad you figured that out. It obviously is because you know there are a great many people on this forum who do not even check Google. I have had the error occur on environments myself and that has proven to fix most of them so rather than copy out the article, linking to it is simple, quick and retains the credit of the author.
Was This Post Helpful? 0
  • +
  • -

#5 indyarocks  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 104
  • Joined: 07-March 12

Re: ERROR 2002 (HY000): Can't connect to local MySQL server through so

Posted 19 July 2012 - 04:54 AM

Guys..somehow after a lots of struggle, I found the solution. (Mac OS X Lion)

1. Uninstalled earlier mysql.
2. brew install mysql

What I was missing earlier is:
Set up databases to run AS YOUR USER ACCOUNT with:
1. unset TMPDIR
2. mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

Now its working as expected. I think the main issue was, it was searching for mysql.sock in /tmp/ dir. But the default TMPDIR was set to something else. The two commands did magic. :)

Thanks,
Indy

View PostKruithne, on 19 July 2012 - 04:50 AM, said:

So glad you figured that out. It obviously is because you know there are a great many people on this forum who do not even check Google. I have had the error occur on environments myself and that has proven to fix most of them so rather than copy out the article, linking to it is simple, quick and retains the credit of the author.


Dude, don't know about you, but I post a problem only when I can't find any solution on google or manual. Don't count me among those lunatics.
Secondly, instead of copy paste, you could have simply explained the problem in your own terms,

\Doubt: provided you understood what you were doing.

This post has been edited by indyarocks: 19 July 2012 - 04:55 AM

Was This Post Helpful? 0
  • +
  • -

#6 Kruithne  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 99
  • View blog
  • Posts: 442
  • Joined: 28-July 09

Re: ERROR 2002 (HY000): Can't connect to local MySQL server through so

Posted 19 July 2012 - 05:54 AM

Quote

Dude, don't know about you, but I post a problem only when I can't find any solution on google or manual. Don't count me among those lunatics.
Secondly, instead of copy paste, you could have simply explained the problem in your own terms,


How am I supposed to know about you and how you operate? There were no replies to the thread therefore giving you a link to something that fixes what appeared to be a common problem did no harm. There is no need for anyone to get bent out of shape when this is supposed to be for mature people.
Was This Post Helpful? 0
  • +
  • -

#7 indyarocks  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 104
  • Joined: 07-March 12

Re: ERROR 2002 (HY000): Can't connect to local MySQL server through so

Posted 19 July 2012 - 06:11 AM

View PostKruithne, on 19 July 2012 - 05:54 AM, said:

How am I supposed to know about you and how you operate? There were no replies to the thread therefore giving you a link to something that fixes what appeared to be a common problem did no harm. There is no need for anyone to get bent out of shape when this is supposed to be for mature people.


Totally true. How can you know that how do I operate!! Thanks for the link .
BTW, the actual problem and its solution I have written in my last reply. You can keep the link of my last post as reference for your future post. :P

This post has been edited by indyarocks: 19 July 2012 - 06:15 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1