thinkphp 数据库连接报错 SQLSTATE[HY000] [2002] No such file or directory
Posted jiangfeilong
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了thinkphp 数据库连接报错 SQLSTATE[HY000] [2002] No such file or directory相关的知识,希望对你有一定的参考价值。
https://blog.csdn.net/tornge/article/details/51388233
找到mysql sokcet的路径
vim /etc/mysql/mysql.conf.d/mysqld.cnf
socket = /var/run/mysqld/mysqld.sock
在php.ini中关于mysql的socket路径的地方,修改如如下
[Pdo_mysql] ; If mysqlnd is used: Number of cache slots for the internal result set cache ; http://php.net/pdo_mysql.cache_size pdo_mysql.cache_size = 2000 ; Default socket name for local MySQL connects. If empty, uses the built-in ; MySQL defaults. ; http://php.net/pdo_mysql.default-socket pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock
以上是关于thinkphp 数据库连接报错 SQLSTATE[HY000] [2002] No such file or directory的主要内容,如果未能解决你的问题,请参考以下文章
PHP PDO连接SQLSERVER报错:SQLSTATE[08001]: [Microsoft][SQL Server Native Client 10.0]TCP Provider
macos下,禅道安装报 连接报错:SQLSTATE[HY000] [2002] No such file or directory