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

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

    When you install php53-mysql using port it returns the following message which is the solution to this problem:

    To use mysqlnd with a local MySQL server, edit /opt/local/etc/php53/php.ini
    and set mysql.default_socket, mysqli.default_socket and
    pdo_mysql.default_socket to the path to your MySQL server's socket file.
    
    For mysql5, use /opt/local/var/run/mysql5/mysqld.sock
    For mysql51, use /opt/local/var/run/mysql51/mysqld.sock
    For mysql55, use /opt/local/var/run/mysql55/mysqld.sock
    For mariadb, use /opt/local/var/run/mariadb/mysqld.sock
    For percona, use /opt/local/var/run/percona/mysqld.sock
    

提交回复
热议问题