Can't connect to local MySQL server through socket homebrew

后端 未结 21 1966
萌比男神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:15

    I had some directories left from another mysql(8.0) installation, that were not removed.

    I solved this by doing the following:

    First uninstall mysql

    brew uninstall mysql@5.6
    

    Delete the folders/files that were not removed

    rm -rf /usr/local/var/mysql
    rm /usr/local/etc/my.cnf
    

    Reinstall mysql and link it

    brew install mysql@5.6
    brew link --force mysql@5.6
    

    Enable and start the service

    brew services start mysql@5.6
    

提交回复
热议问题