报SQLSTATE[HY000] [2002] No such file or directory错误,
需要在mysql中执行:show variables like '%sock%'
,
这里值为/tmp/mysql.sock
,
将socket的value值写入.env中,
增加DB_SOCKET=/tmp/mysql.sock,
config/database.php,
connections的mysql下增加'unix_socket' => env('DB_SOCKET', ''),
清缓存:
php artisan view:clear
php artisan config:cache
php artisan cache:clear
增加了还报错,或者修改了mysql的配置但是依旧不生效的话,删除bootstrap/cache的缓存文件!!!