Can't connect to local MySQL server through socket homebrew

后端 未结 21 1959
萌比男神i
萌比男神i 2020-12-04 05:54

I recently tried installing MySQL with homebrew (brew install mysql) and when I try to run it I get the following error:

ERROR 2002 (HY00

21条回答
  •  日久生厌
    2020-12-04 06:40

    When you got the server running via

    mysql.server start

    you should see the socket in /tmp/mysql.sock. However, the system seems to expect it in /var/mysql/mysql.sock. To fix this, you have to create a symlink in /var/mysql:

    sudo mkdir /var/mysql

    sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

    This solved it for me. Now my phpMyAdmin works happily with localhost and 127.0.0.1.

    Credit goes to Henry

提交回复
热议问题