【问题标题】:laravel php artisan migrate Error (timeout)laravel php artisan migrate 错误(超时)
【发布时间】:2018-08-04 17:59:08
【问题描述】:

我正在使用 Laravel 5.6

当我使用命令“php artisan migrate”时,我得到了这个错误(一分钟后):

“Illuminate\Database\QueryException : SQLSTATE[HY000] [2002] 操作超时(SQL: select * from information_schema.tables where table_schema = MYDATABASE and table_name = migrations)”

我已经在 .env 和 config/database.php 中设置了正确的数据库配置

我检查了我的数据库连接是否有效: 如果(数据库::连接()->getDatabaseName()) { echo "是!成功连接到数据库:" . DB::connection()->getDatabaseName(); }

而且它有效。

如果我直接在 mysql 中运行查询,由于缺少引号,它将无法工作。 相反,如果我在 mysql 中运行它,它将起作用:

select * from information_schema.tables where table_schema = 'MYDATABASE' and table_name = 'migrations'

php artisan 中的问题似乎是:“操作超时” (当我试图在这里寻找答案时,不是通常的“找不到文件”。

如何解决 php artisan 迁移问题 ??? 谢谢!


【问题讨论】:

    标签: laravel-5 laravel-artisan artisan-migrate


    【解决方案1】:

    我遇到了同样的问题,结果发现我的主机不正确。

    在我的.env 文件中,我将DB_HOST 设置为正确的值,这一切都像一个魅力。

    【讨论】:

    • 我在 Mac 中使用代客泊车时确实遇到了同样的问题,请您帮帮我。
    猜你喜欢
    • 2016-05-14
    • 2016-10-14
    • 2020-10-23
    • 2016-07-07
    • 1970-01-01
    • 1970-01-01
    • 2020-11-27
    • 2021-12-11
    • 2016-08-09
    相关资源
    最近更新 更多