Reputation: 18833
I am trying to get a laravel5-example project working. One of the steps seems very basic but I do not know how to do it:
Create a database and inform .env
With laravel 5 my .env file looks like:
APP_ENV=local
APP_DEBUG=true
APP_KEY=B0ST6bRoqxVJ2JtUNPtittJup6mRJef2
DB_HOST=127.0.0.1
DB_DATABASE=laravel_base
DB_USERNAME=root
DB_PASSWORD=
CACHE_DRIVER=file
SESSION_DRIVER=file
When I try to seed the database I get an error:
$ php artisan migrate --seed
[PDOException]
SQLSTATE[HY000] [2002] Connection refused
How do I create a database so I can run my laravel application on my mac? I have postgres installed. The default for this application is mysql ('default' => 'mysql'
) in config/database.php. If I change it to 'default' => 'pgsql'
I get a different error:
$ php artisan migrate --seed
[PDOException]
could not find driver
I don't really care if I have mysql or psql database, just want it to work. Mysql is the default though, so might be better to stick with that. What are the commands to set up mysql/psql databases for laravel projects?
Upvotes: 0
Views: 1508
Reputation: 111829
You should make sure:
php.ini
PDO PostgreSQL enabled (extension=php_pdo_pgsql.dll
not starting with ;
).env
DB_CONNECTION to pgsql
(or default
do pgsql
in config/database.php
depending what specific version of Laravel you use (5.0 or 5.1/5.2))If you won't be able to make it work, you should think of installing Laravel Homestead that has everything needed to develop Laravel applications
Upvotes: 1