2

When i'm trying to start MySQL server the following error occur:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Any ideas what this error means and how I can fix it?

2
  • What OS are you attempting to run MySQL on?
    – Kenny
    Commented Sep 18, 2011 at 18:10
  • Mac os x (lion)
    – amg
    Commented Sep 19, 2011 at 7:49

2 Answers 2

0

This article may be of use.
Solve: Can’t connect to local MySQL server through socket /tmp/mysql.sock

Below is an a part of the article with the most important bit. (Read the whole article for the solution)


For the mysql client, the default location of this socket file is /tmp/mysql.sock. However, for a variety of reasons, many MySQL installations place this socket file somewhere else like /var/lib/mysql/mysql.sock.

0

OK, so the most likely explanation for this error is that you've not got the MySQL server running. Since you're running on a Mac, try this to start MySQL:

user@host:~$ cd /usr/local/mysql
user@host:~$ sudo ./bin/mysqld_safe &

After that last command, you might need to press your ENTER key one extra time to get the command prompt back to showing what you'd normally expect, but the MySQL server should now be started - look at the output and it'll hopefully say something like:

user@host:~$ 110923 20:13:23 mysqld_safe Logging to '/usr/local/mysql-5.1.53-osx10.6-x86_64/data/teaksaw.local.err'.
110923 20:13:23 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql-5.1.53-osx10.6-x86_64/data

Now, try logging in to mysql:

user@host:~$ mysql -u root

Hopefully, you're now cooking with gas.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .