2002 No such file or directory

最近安装php7 忽然发现mysql用不了,临时解决了一下,php.ini里面配置了下mysqli.socket文件地址

http://php.net/manual/zh/book.mysqlnd.php


For those who manually compiled MySQL, the default
mysqlnd settings may results in error.
Your mysql_error() function may give you this message:

—————————
No such file or directory (trying to connect via unix:///tmp/mysql.sock)
—————————

This is because your manually compiled MySQL has its own place for socket.
You need to provide PHP a reference for an appropriate mysql socket.
That means you need to edit php.ini and add a section like this:

—————————
[mysql]
mysql.default_socket=”/your/path/to/mysql.sock”
—————————

https://stackoverflow.com/questions/1676688/php-mysql-connection-not-working-2002-no-such-file-or-directory

此条目发表在 异常解决办法 分类目录。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*


*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>