gpt4 book ai didi

php - 运行迁移时的“No such file or directory”或“No such host is known”

转载 作者:行者123 更新时间:2023-12-03 21:14:30 26 4
gpt4 key购买 nike

我从名为migrations的Laravel 5.4数据库中删除了laravel表。当我运行php artisan migrate:install时,出现以下错误:

[Illuminate\Database\QueryException]
SQLSTATE[HY000] [2002] No such file or directory
(SQL: select * from information_schema.tables where table_schema = laravel
and table_name = migrations)
我删除并重新创建了数据库。我还运行了 composer update。没运气。我可以在phpMyAdmin中运行命令并手动创建表。
有时,此问题也以类似的2002错误表现出来:
[Illuminate\Database\QueryException]
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No such host is known.
(SQL: select * from information_schema.tables where table_schema = laravel
and table_name = migrations and table_type = 'BASE TABLE')
[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 = laravel
and table_name = migrations and table_type = 'BASE TABLE')

最佳答案

如果您将localhost用作DATABASE_HOST文件中的.env,请将其更改为127.0.0.1,然后运行php artisan config:clear并现在再次尝试php artisan migrate:install

关于php - 运行迁移时的“No such file or directory”或“No such host is known”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46407490/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com