使用的是ThinkPHP5框架报错,只需要将配置文件修改DB_HOST 由127.0.0.1改成localhost
'DB_HOST' => 'localhost', // 服务器地址

 

数据库连接提示:SQLSTATE[HY000] [2002] No such file or directory

要保证在php.ini和mysql配置文件my.conf 中,关于mysql.sock的路径的定义统一
php.ini

pdo_mysql.default_socket=/var/lib/mysql/mysql.sock

my.conf

socket=/var/lib/mysql/mysql.sock

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-15
  • 2022-02-07
  • 2021-11-28
猜你喜欢
  • 2022-01-16
  • 2022-12-23
  • 2021-09-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案