Laravel使用无业游民:php artisan migration --seed提供错误

时间:2020-02-26 16:32:29

标签: php mysql laravel laravel-5 vagrant

宅基版本:9.2.0 流浪版本:2.2.7 php版本:7.2.21 mysql版本:8.0.18

我创建了一个新的laravel项目。我创建了一个名为票证的数据库。我已经从https://github.com/creativetimofficial/material-dashboard-laravel添加了第三方代码。当我执行运行“ php artisan migration --seed”的步骤时,我遇到了两个有关我如何在.env文件中设置数据库端口的错误。

这是我的数据库用户及其主机的图片。

enter image description here

当DB_HOST = 127.0.0.1并运行artisan migration时,出现错误消息,提示连接被拒绝。我只尝试使用127.0.0.1,因为我看到在线用户说要使用它而不是localhost。由于连接被拒绝,我有种感觉,这是不正确的。

当DB_HOST = localhost并运行artisan migration时,出现错误消息

No such file or directory (SQL: select * from information_schema.tables where table_schema = tickets and table_name = migrations and table_type = 'BASE TABLE') {"exception":"[object] (Illuminate\\Database\\QueryException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = tickets and table_name = migrations and table_type = 'BASE TABLE') at /Applications/MAMP/htdocs/ticket-dashboard/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669)

问题: 1)我应该使用IP而不是本地主机吗?如果是,为什么使用IP却拒绝连接? 2)如果使用localhost没问题,那么需要解决什么才能绕过此错误?

我一直在测试我在网上可以找到的所有内容,但这是我得到的最接近的东西。任何建议或想法将不胜感激

0 个答案:

没有答案