Search code examples
laravel-5homestead

How to connect to PostgreSQL database with Laravel Homestead?


I have updated the DB connection in my .env file to change the default mysql database to use PostgreSQL DB. But I don't know how to proceed with this.

DB_CONNECTION=pgsql

For example, we use

mysql -uhomestead -psecret <DB Name>

to connect to our database. By using psql, how to connect to DB?


Solution

  • Try this one,

    psql -U homestead -h localhost <DB Name>
    

    After that, it will ask for password, enter secret. That's it.