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

后端 未结 17 2457
长发绾君心
长发绾君心 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:55

    Fix the looming 2002 socket error – which is linking where MySQL places the socket and where OSX thinks it should be, MySQL puts it in /tmp and OSX looks for it in /var/mysql the socket is a type of file that allows mysql client/server communication.

    sudo mkdir /var/mysql
    

    and then

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

    source: http://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-10-yosemite/

提交回复
热议问题