DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
端口配置3306
执行php artisan migrate
报如下错误:
IlluminateDatabaseQueryException : SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrations)
at /Users/tangmoqi/code/znspt/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
660| // If an exception occurs when attempting to run a query, we'll format the error
661| // message to include the bindings with SQL, which will make this exception a
662| // lot more helpful to the developer instead of just the database's errors.
663| catch (Exception $e) {
664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|
Exception trace:
1 DoctrineDBALDriverPDOException::("SQLSTATE[HY000] [2002] Connection refused")
/Users/tangmoqi/code/znspt/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31
2 PDOException::("SQLSTATE[HY000] [2002] Connection refused")
/Users/tangmoqi/code/znspt/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27
Please use the argument -v to see more details.