连接被拒绝:Laravel

时间:2018-03-06 08:07:13

标签: sql laravel sqlite connection migration

" SQLSTATE [HY000] [2002] 拒绝连接(SQL:select * from information_schema.tables   其中table_schema = homestead和table_name = migrations)"

database.php

'connections' => [

        'sqlite' => [
            'driver' => 'sqlite',
            'database' => env('DB_DATABASE', database_path('database.sqlite')),
            'prefix' => '',
        ],

迁移

public function up(){
        Schema::create('cards', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id');
            $table->string('title');
            $table->timestamps();
        });
    }

1 个答案:

答案 0 :(得分:0)

编辑.env文件:

DB_CONNECTION=sqlite

config/database.php档案:

替换

'database' => env('DB_DATABASE', database_path('database.sqlite')),

'database' => database_path('database.sqlite'),

来自https://laracasts.com/discuss/channels/laravel/pdoexception-sqlstatehy000-2002-connection-refused