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

前端 未结 30 1351
南旧
南旧 2020-12-04 05:14

I installed MySQL on Mac OS X Mountain Lion with homebrew install mysql, but when I tried mysql -u root I got the following error:

30条回答
  •  甜味超标
    2020-12-04 05:53

    Below I'm including the latest instructions from brew install mysql so newer searches for this issue can benefit:

    $ brew install mysql
    ==> Downloading https://homebrew.bintray.com/bottles/mysql-5.6.26.yosemite.bottle.1.tar.gz
    ######################################################################## 100.0%
    ==> Pouring mysql-5.6.26.yosemite.bottle.1.tar.gz
    
    To connect:
        mysql -uroot
    
    To have launchd start mysql at login:
      ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
    Then to load mysql now:
      launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
    Or, if you don't want/need launchctl, you can just run:
      mysql.server start
    

    In my case I loaded mysql now via launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist and was then able to launch $ mysql and be on my way.

    I hope this helps recent troubleshooters!

提交回复
热议问题