5

I am on macOS 10.12.3. Installed and running MySQL through Homebrew. Whenever i try to start MySQL with brew services start mysql or sudo mysql.server start command on terminal, it starts. Following is my my.cnf file residing into /etc/my.cnf

[mysqld]
user=mysql
basedir=/usr/local/Cellar/mysql/5.7.17
datadir=/usr/local/var/mysql
port=3306
server_id=1
socket=/tmp/mysql.sock

[client]
user=mysql
basedir=/usr/local/Cellar/mysql/5.7.17
datadir=/usr/local/var/mysql
port=3306
server_id=1
socket=/tmp/mysql.sock

Then i try to connect to MySQL using Perfect-MySQL following the instructions there. But failed to locate and connect to socket file. Got the following error,

[ERR] MySQL connection error: Can't connect to local MySQL server through socket '' (2)
[ERR] Error msg: error("MySQL server has gone away")

Clearly it failed to identify socket file path which should be /tmp/mysql.sock. But after running mysql server i found mysql.sock.lock.lock file into /tmp/ folder, there were no mysql.sock file. Then i changed the my.cnf file with socket=/tmp/mysql.sock.lock.lock . but same result.

I have no other mysql client/service installed and tried freshly reinstalling with homebrew several times. Same result everytime.

I have tried with a lot of other options but no luck. CLearly i am missing something. Can someone please shade some light on it ?

How and from where i can set mysql.sock path ?

Partho Biswas
  • 2,290
  • 1
  • 24
  • 39
  • 1
    Partho did you ever find a fix for this? Running into the same issue following the latest MacOS High Sierra update. – CFitz Nov 04 '17 at 17:56
  • If the socket isn't being created at all, see https://stackoverflow.com/questions/15016376/cant-connect-to-local-mysql-server-through-socket-homebrew/47435668 – Ben Claar Nov 22 '17 at 13:16

0 Answers0