在mac中执行php artisan migrate时报错

SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = weifenxiao and table_name = migrations) 

[PDOException]
SQLSTATE[HY000] [2002] No such file or directory

这个是由于找不到mysql.sock文件造成的

1.在MySQL里面执行sql语句 show variables like '%sock%'

2.对应返回的结果的字段 socket 的对应的value,一般的结果大概长这个样子 /tmp/mysql.sock

3.修改文件 ./config/database.php 中的 connections 下的 mysql 添加

‘unix_socket’ => ‘/tmp/mysql.sock’

这样就可以执行了

 

相关文章:

  • 2022-12-23
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-10
  • 2021-08-18
猜你喜欢
  • 2021-12-28
  • 2021-06-26
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
相关资源
相似解决方案