dimanche 27 décembre 2015

how to set up a database for laravel 5? (connection refused error)

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?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire