Partho Biswas
Partho Biswas

Reputation: 2330

For homebrew mysql installs, how to fix mysql.sock path?

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 ?

Upvotes: 5

Views: 8465

Answers (0)

Related Questions