我试图在新创建的laravel项目中迁移我的表,并得到这个错误,但所有的容器都运行良好。
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for mysql failed: nodename nor servname provided, or not known (Connection: mysql, SQL: select * from information_schema.tables where table_schema = example_app and table_name = migrations and table_type = 'BASE TABLE')at vendor/laravel/framework/src/Illuminate/Database/Connection.php:760
756▕ // If an exception occurs when attempting to run a query, we'll format the error
757▕ // message to include the bindings with SQL, which will make this exception a
758▕ // lot more helpful to the developer instead of just the database's errors.
759▕ catch (Exception $e) {
➜ 760▕ throw new QueryException(
761▕ $this->getName(), $query, $this->prepareBindings($bindings), $e
762▕ );
763▕ }
764▕ }
+47 vendor frames
48 artisan:35
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
我尝试将我的表从本地迁移到管理员。
1条答案
按热度按时间8yparm6h1#
错误消息指出无法连接到数据库。
在
config/database.php
中,检查host
port
database
username
password
如果你从
.env
设置它,检查值是否正确。如果正确,运行下面的代码来清除配置缓存。