简体   繁体   English

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

[英]When I run "php artisan migrate" code in terminal I can't create table on http: // localhost / phpmyadmin /

Illuminate\\Database\\QueryException照亮\\数据库\\查询异常

SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = TestLaravel and table_name = migrations and table_type = 'BASE TABLE') SQLSTATE[HY000] [2002] 没有这样的文件或目录(SQL:select * from information_schema.tables where table_schema = TestLaravel and table_name = migrations and 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()
  • using flags on command you use php artisan migrate --env=production may solve problem in some cases在命令上使用标志你使用php artisan migrate --env=production在某些情况下可能会解决问题

  • check file app/config/database.php for relevant host key to be 'host' => env('DB_HOST', '127.0.0.1') , not localhost检查文件app/config/database.php的相关主机密钥为'host' => env('DB_HOST', '127.0.0.1') ,而不是localhost

  • check file .env for relevant line to be DB_HOST=127.0.0.1 , not localhost检查文件.env的相关行是DB_HOST=127.0.0.1 ,而不是localhost

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM