php artisan migrate 报错 SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from

今天在laravel项目中执行报错,如下:

环境是MAMP+php7.2+apache

admindeMBP:chat admin$ php artisan migrate
In Connection.php line 664:            

  SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from inform  

  ation_schema.tables where table_schema = homestead and table_name = migrations)      

In Connector.php line 67:

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

解决方法:配置laravel     'unix_socket' => env('DB_SOCKET', '')

DB_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock                                                    

然后再执行php artisan migrate

Migration table created successfully.

你可能感兴趣的:(laravel,php)