【发布时间】:2021-03-22 01:43:32
【问题描述】:
我不明白为什么我的迁移在全新安装 Laravel 8 时失败。这就是我得到的结果:
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known (SQL: select * from information_schema.tables where table_schema = bunny and table_name = migrations and table_type = 'BASE TABLE')
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:678
674▕ // If an exception occurs when attempting to run a query, we'll format the error
675▕ // message to include the bindings with SQL, which will make this exception a
676▕ // lot more helpful to the developer instead of just the database's errors.
677▕ catch (Exception $e) {
➜ 678▕ throw new QueryException(
679▕ $query, $this->prepareBindings($bindings), $e
680▕ );
681▕ }
682▕
+33 vendor frames
34 artisan:37
Illuminate\Foundation\Console\Kernel::handle()
我正在使用带有完美 Laravel 环境的 Kali linux,但版本 8 无法正常工作。
【问题讨论】:
-
这表示它无法解析你的选项中指定的数据库的IP(可能是你的.env文件)
-
检查
.env文件是否正确设置了DB_HOST(并且不会出现两次,具有正确和错误的值)。 -
你尝试过什么调试问题?
标签: php mysql laravel laravel-8