微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

当我在终端中运行“ php artisan migration”代码时,无法在http上创建表:// localhost / phpmyadmin /

如何解决当我在终端中运行“ php artisan migration”代码时,无法在http上创建表:// localhost / phpmyadmin /

Illuminate \ Database \ QueryException

sqlSTATE [HY000] [2002]没有这样的文件或目录(sql:从information_schema.tables中选择*,其中table_schema = TestLaravel,table_name =迁移,并且table_type ='BASE TABLE')

at vendor/laravel/framework/src/Illuminate/Database/Connection.PHP:671
   667▕         // If an exception occurs when attempting to run a query,we'll format the error
    668▕         // message to include the bindings with sql,which will make this exception a
    669▕         // lot more helpful to the developer instead of just the database's errors.
    670▕         catch (Exception $e) {
  ➜ 671▕             throw new QueryException(
    672▕                 $query,$this->prepareBindings($bindings),$e
    673▕             );
    674▕         }
    675▕ 

      +36 vendor frames 
  37  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

解决方法

  • 在您使用php artisan migrate --env=production的命令上使用标志可以在某些情况下解决问题

  • 检查文件app/config/database.php的相关 host 密钥是否为'host' => env('DB_HOST','127.0.0.1'),而不是 localhost

  • 检查文件.env的相关行为DB_HOST=127.0.0.1,而不是 localhost

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。