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

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

    You can do it by simply aliasing the MAMP php on Apple terminal:

    alias phpmamp='/Applications/MAMP/bin/php/php7.0.0/bin/php'
    

    Example: > phpmamp - v

    Now you can run something like: > phpmamp scriptname.php

    Note: This will be applied only for the current terminal session.

提交回复
热议问题