hello,
following the Laravel From Scratch No.13 authenticate your users laracast
i followed the instructions,
laravel new some-project, php artisan make:auth, touch database/database.sqlite and
default database connection set to sqlite, so far so good.
after trying, php artisan migrate..
i get the following error...
[PDOException] SQLSTATE[HY000] [2002] Connection refused,
checking phpinfo i have the pdo driver for sqlite3 enabled
i've been googling this issue for quite some time but can't find any decent information on sqlite :(
i was hoping i could make the migrations via homestead like i do when using mysql but unfortunately i'm just getting nothing to migrate(this would be really handy if possible),
any helpfull advice appreciated thanks.
I am having the same problem. I set sqlite as my default connection but it seems Laravel is still trying to use Mysql when I reun artisan migrate
[PDOException]
SQLSTATE[HY000] [2002] Connection refused
Exception trace:
() at /Users/steve/devapps/tutorials/laravel/track-model-activity/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:55
PDO->__construct() at /Users/steve/devapps/tutorials/laravel/track-model-activity/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:55
Illuminate\Database\Connectors\Connector->createConnection() at /Users/steve/devapps/tutorials/laravel/track-model-activity/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php:24
Illuminate\Database\Connectors\MySqlConnector->connect() at /Users/steve/devapps/tutorials/laravel/track-model-activity/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php:61
Okay I have found the answer.
Apparently, your .env file values overwrite what is in your database config file. So you need to set your DB_CONNECTION = sqlite. That should work.
i had to do this "So you need to set your DB_CONNECTION = sqlite" ,(in the .env file)
and change.. 'database' => env('DB_DATABASE', database_path('database.sqlite')), to 'database' => database_path('database.sqlite'),(in the database.php file)
You could also just remove the env variable DB_DATABASE so you don't have to touch the config file, and database_path is no longer in storage but database. I'm not sure if that's a bug or an update.
I just ran into this problem as well, and after almost 30 minutes of trial and error using tips from answers above I got it working like it's supposed to.
I simply restarted the php artisan serve server after I had created the database/database.sqlite manually. I also ran php artisan config:clear just to clear out any possible cache of the config files.
I had to run php artisan config:clear and then php artisan serve (again) after my migration to get it to work. Basically, I had to restart the PHP server because of object caching I think.