1
votes

"SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrations)"

database.php

'connections' => [

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

migrations

public function up(){
        Schema::create('cards', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id');
            $table->string('title');
            $table->timestamps();
        });
    }
1
Please show some code...Ahsan
did you set database access in .env file?Ahsan
Please also provide some context. What is it that you want to achieve? Where are the issues? What have you tried? See: stackoverflow.com/help/how-to-askNOhs
error is in connection.php and connector.phpBibek

1 Answers

1
votes

Edit your .env file:

DB_CONNECTION=sqlite

and

config/database.php file:

replace

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

with

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

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