Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in
提供的信息太少
For some reason mysql on OS X gets the locations of the required socket file a bit wrong, but thanks to a veritable wizard I know (that's you, Gavin) the solution is as simple as setting up a symbolic link.
You may have a socket (appearing as a zero length file) as /tmp/mysql.sock or /var/mysql/mysql.sock but 1 or more apps is looking in the other location for it.
Rather than move the socket and have to edit config files and remember to keep edited files local and away from servers where the paths are correct, simply create a symbolic link so your mac finds the required socket, even when it's looking in the wrong place!
If you have /tmp/mysql.sock but no /var/mysql/mysql.sock then...
cd /var sudo mkdir mysqlsudo chmod 755 mysqlcd mysqlln -s /tmp/mysql.sock mysql.sock
cd /tmpln -s /var/mysql/mysql.sock mysql.sock
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号