Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in

后端 未结 17 2058
长发绾君心
长发绾君心 2020-11-22 08:27

I\'m trying to connect to my MySQL DB with the Terminal on my Apple (With PHP).

Yesterday it worked fine, and now I suddenly get the error in the title.

The

17条回答
  •  灰色年华
    2020-11-22 08:54

    Mac OS X EL Capitan + MAMP Pro Do this

    cd /var
    sudo mkdir mysql
    sudo chmod 755 mysql
    cd mysql
    sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock mysql.sock
    

    Then do this

    cd /tmp
    sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock mysql.sock
    

    Hope this saves you some time.

提交回复
热议问题