【问题标题】:How to connect to PostgreSQL database with Laravel Homestead?如何使用 Laravel Homestead 连接到 PostgreSQL 数据库?
【发布时间】:2016-03-17 06:10:06
【问题描述】:

我已在我的 .env 文件中更新了数据库连接,以将默认 mysql 数据库更改为使用 PostgreSQL 数据库。但我不知道该怎么做。

DB_CONNECTION=pgsql

例如,我们使用

mysql -uhomestead -psecret <DB Name>

连接到我们的数据库。使用psql,如何连接DB?

【问题讨论】:

  • psql -Uhomestead &lt;DB Name&gt;

标签: laravel-5 homestead


【解决方案1】:

试试这个,

psql -U homestead -h localhost <DB Name>

之后,它会要求输入密码,输入密码。就是这样。

【讨论】:

    【解决方案2】:

    要通过ssh 使用psql 连接到postgress,我这样做:

    psql -U homestead -h 127.0.0.1 -p 5432 myappdb
    
    # this will ask for a password
    # the default in homestead is secret
    

    【讨论】:

      猜你喜欢
      • 2017-11-21
      • 2014-07-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-03
      • 2016-12-03
      • 2020-12-26
      • 1970-01-01
      相关资源
      最近更新 更多