“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();
});
}
编辑.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