在本地,我已经将我的Laravel应用程序从宅基地迁移到了Sail。除了调度程序,一切都运行良好。
调用数据库的“我的命令”会在日志中生成以下错误:
[2023-11-07 08:50:02] local.ERROR: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for mysql failed: Temporary failure in name resolution (Connection: mysql, SQL: select * from information_schema.tables where table_schema = my_database and table_name = workflows and table_type = 'BASE TABLE') {"exception":"[object] (Illuminate\\Database\\QueryException(code: 2002): SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for mysql failed: Temporary failure in name resolution (Connection: mysql, SQL: select * from information_schema.tables where table_schema = my_database and table_name = workflows and table_type = 'BASE TABLE') at /home/vagrant/code/my_project/back/vendor/laravel/framework/src/Illuminate/Database/Connection.php:801)
[stacktrace]
#0 /home/vagrant/code/my_project/back/vendor/laravel/framework/src/Illuminate/Database/Connection.php(951): Illuminate\\Database\\Connection->runQueryCallback()
#1 /home/vagrant/code/my_project/back/vendor/laravel/framework/src/Illuminate/Database/Connection.php(930): Illuminate\\Database\\Connection->tryAgainIfCausedByLostConnection()
#2 /home/vagrant/code/my_project/back/vendor/laravel/framework/src/Illuminate/Database/Connection.php(757): Illuminate\\Database\\Connection->handleQueryException()
#3 /home/vagrant/code/my_project/back/vendor/laravel/framework/src/Illuminate/Database/Connection.php(407): Illuminate\\Database\\Connection->run()
#4 /home/vagrant/code/my_project/back/vendor/laravel/framework/src/Illuminate/Database/Connection.php(394): Illuminate\\Database\\Connection->select()
#5 /home/vagrant/code/my_project/back/vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php(43): Illuminate\\Database\\Connection->selectFromWriteConnection()
#6 /home/vagrant/code/my_project/back/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(353): Illuminate\\Database\\Schema\\MySqlBuilder->hasTable()
#7 /home/vagrant/code/my_project/back/app/Console/Commands/TestCommand.php(30): Illuminate\\Support\\Facades\\Facade::__callStatic()
#8 /home/vagrant/code/my_project/back/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Console\\Commands\\TestCommand->handle()
#9 /home/vagrant/code/my_project/back/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#10 /home/vagrant/code/my_project/back/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#11 /home/vagrant/code/my_project/back/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#12 /home/vagrant/code/my_project/back/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#13 /home/vagrant/code/my_project/back/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\\Container\\Container->call()
#14 /home/vagrant/code/my_project/back/vendor/symfony/console/Command/Command.php(326): Illuminate\\Console\\Command->execute()
#15 /home/vagrant/code/my_project/back/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\\Component\\Console\\Command\\Command->run()
#16 /home/vagrant/code/my_project/back/vendor/symfony/console/Application.php(1081): Illuminate\\Console\\Command->run()
#17 /home/vagrant/code/my_project/back/vendor/symfony/console/Application.php(320): Symfony\\Component\\Console\\Application->doRunCommand()
#18 /home/vagrant/code/my_project/back/vendor/symfony/console/Application.php(174): Symfony\\Component\\Console\\Application->doRun()
#19 /home/vagrant/code/my_project/back/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run()
#20 /home/vagrant/code/my_project/back/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
#21 {main}
字符串
日志中的路径显示了宅基地的遗留路径(/home/vagrant/my_project/back/...)。这怎么可能呢?
新的赛欧路径为/var/www/html/...
我猜错误可能来自于不正确的路径...
谢谢
1条答案
按热度按时间yqyhoc1h1#
你
字符串
query是不正确的,因为你没有在
my_database
和workflows
周围加上引号。这意味着你的编译器传递这些参数时没有将它们括在引号中。你需要查看你的调度程序或设置,并微调最终将生成的查询。编辑:
事实证明(基于我们在评论部分的讨论),查询实际上是正确的,但是@superfive33从ORM日志中粘贴了它。
因此,名称解析时临时失败是主机名无法解析为IP地址时发生的错误:https://tecadmin.net/resolved-temporary-failure-in-name-resolution-error-in-linux/
在这种情况下,您需要检查您的互联网连接(您已经通过发送此问题这样做),验证DNS设置(在/etc/resolv.conf),检查您的主机文件(在/etc/hosts),并将它们与您以前的设置进行比较,如果它仍然可用。清除DNS缓存并重新启动网络服务。
您可以通过运行以下命令检查主机名是否存在:
型
在您的终端中。您可能还需要验证VPN并检查您的数据库位置是否已移动。或者您已移动到其他网络。