【发布时间】:2020-09-26 13:44:57
【问题描述】:
我在我的 Mac 上工作,我正在尝试连接到数据库,如 env 文件中所示,我提到了 db 名称,但在我的 laravel 项目中仍然出现此错误。我已经在核心 php 项目上尝试过它可以工作,但是在将 laravel 项目连接到数据库时出现此错误。
SQLSTATE[HY000] [2002] 连接被拒绝 (SQL: select * from information_schema.tables where table_schema = cart and table_name = migrations and table_type = 'BASE TABLE') 在 vendor/laravel/framework/src/Illuminate/Database/ Connection.php:671
667| // If an exception occurs when attempting to run a query, we'll format the error
668| // message to include the bindings with SQL, which will make this exception a
669| // lot more helpful to the developer instead of just the database's errors.
670| catch (Exception $e) {
671| throw new QueryException(
672| $query, $this->prepareBindings($bindings), $e
673| );
674| }
675|
【问题讨论】: