【发布时间】:2020-07-29 05:34:53
【问题描述】:
我安装并打开了 XAMPP,这是我访问 phpmyadmin 页面的方式。我在 phpmyadmin 中创建了一个名为“firstdb”的数据库。
我还在本地存储的 laravel 文件中创建了身份验证。我正在尝试使用 php artisan migrate 迁移表,但出现以下错误。
user@Andress-MacBook-Pro admin-panel % php artisan migrate
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = firstdb and table_name = migrations and table_type = 'BASE TABLE')
at 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|
+37 vendor frames
38 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
我到处找,请帮忙。
【问题讨论】:
-
这里的错误是“连接被拒绝”。它试图运行的查询是附带的,所以你的标题不会帮助你得到答案。据推测,这只是您的 Laravel 设置中的配置问题。
-
补充 Greg 所说的内容,检查数据库主机、用户名、密码等是否根据您的 XAMPP 环境要求正确设置。
标签: php laravel database-migration migrate