连接被拒绝:Laravel

问题描述 投票:0回答:1

“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();
        });
    }
sql laravel sqlite connection migration
1个回答
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

© www.soinside.com 2019 - 2024. All rights reserved.