So I am attempting to install Mysql through homebrew, while using standard procedure: brew install mysql

But running Mysql will get this well-known error:

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

I am trying this on the brand new computer. There is not a /etc/my.cnf, but editing the socket locations does appear to modify the above error message (but does not repair the problem).

Every other fundamental steps I skipped here?

Is mysql beginning correctly advertising media are /usr/local/bin/safe_mysqld? If that's the case, determine when the /tmp/mysql.sock file is available. Whether it does not, stop mysqld, run 'touch /tmp/mysql.sock', and restart safe_mysqld. If mysql does not start correctly advertising media are safe_mysqld, you may want to install the tables by hand using /usr/local/bin/mysql_install_db, then restart mysql.

To begin with, your mysql server is not running. You can test to begin it using

mysql.server start

In the event that fails, you should check the mistake sign in /usr/local/mysql/data/[HOSTNAME].err. This file provides you with clues. Should you read something similar to

110717 11:41:43  InnoDB: Operating-system error number 13 inside a file operation.

InnoDB: The mistake means mysqld doesn't have the access privileges to

InnoDB: your directory.

InnoDB: File title ./ibdata1

InnoDB: File operation call: 'create'.

InnoDB: Cannot continue operation.

.. you need to make certain that the permissions are correct. For me personally, this solved it:

chown -R mysql:mysql /usr/local/mysql/data

Should you still can't start it next, google the mistake message at the end of /usr/local/mysql/data/[HOSTNAME].err

If this sounds like following a fresh install, its usually because of deficiencies in the required mysql system tables.

Solve with:


Then start the server with:

mysql.server start



just do as instructed from homebrew.

You may either start the server by hand and prevent by hand by mysql.server start and mysql.server stop correspondingly.

otherwise, you should use launchctl to produce it each time you begin the spend.

You are receiving the above mentioned error because you do not have mysqld running.

Do ps -ef grep mysqld and also you should not begin to see the mysqld daemon running.

You do not have to the touch any /tmp/mysql.sock file.