Today, I used PHP to connect to MySQL database on my Mac, and there was
Mac PHP Warning:mysql_connect ():  No such file ...
Details such as the following are seen:
Dirkmacbook:vote dirk$ PHPUnit mytest.php
Warning:mysql_connect (): No such file or directory in/applications/xampp/xamppfiles/htdocs/myvote/vote/conn.php on Line 25
This error, very easy to overcome this problem, enter such as the following command:
Cause Analysis: PHP will be/var/mysql/below to find Mysql.sock (can be found in the/etc/php.ini configuration file). But this one on our Mac doesn't/var/mysqlz this folder. and Mysql.sock file on/tmp/ Mysql.sock below. What to do?
Very easy, we just need to use ln-s to give/var/mysql/to generate a Mysql.sock file "soft connection" can be.
Fix mac PHP connection MySQL error warning:mysql_connect (): No such file or directory in conn.php