【问题标题】:Unable to connect to database using homestead无法使用宅基地连接到数据库
【发布时间】:2021-03-28 10:19:05
【问题描述】:

我在全球范围内使用宅基地,当我尝试将我的数据库详细信息添加到 datagrip 时出现此错误

指定的数据库用户/密码组合被拒绝:[28000] FATAL: no pg_hba.conf entry for host "192.168.10.1", user "homestead", database "dogs", SSL on

这是我的 Homestead.yaml 文件

ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/projects/code
      to: /home/vagrant/code

sites:
    - map: site1.test
      to: /home/vagrant/code/site1/public
    - map: site2.test
      to: /home/vagrant/code/site2/public
    - map: site3.test
      to: /home/vagrant/code/site3/public
      php: "7.4"
    - map: dogs.test
      to: /home/vagrant/code/dogs/public
      php: "7.4"


databases:
    - site1
    - site2
    - site3
    - dogs

features:
    - mysql: true
    - mariadb: false
    - postgresql: true
    - ohmyzsh: false
    - webdriver: false

#services:
#    - enabled:
#        - "postgresql@12-main"
#    - disabled:
#        - "postgresql@11-main"

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

当我尝试连接时,我的 datagrip 中有什么

Host: 192.168.10.10
Port: 5432
Authentication: User & Password
User: homestead
Password: secret
Database: dogs

【问题讨论】:

  • 为什么不使用默认转发端口? laravel.com/docs/8.x/homestead#ports 尝试连接到 localhost:33060 它应该隧道到虚拟机的 mysql 实例
  • 为什么在连接 192.168.10.10 时出现错误是关于主机 192.168.10.1 的?

标签: laravel homestead


【解决方案1】:

曾经遇到过同样的问题。当时我正在与当地的 grafana 合作。一些使用 postgresql 的设置无法在本地使用 10.10 地址正常工作。

我的解决方法是将我的 vagrant box 的 ip 更改为 10.11 。 这解决了问题。

如果你想为其他项目恢复它,你可以轻松做到:

#ip: "192.168.10.11"
ip: "192.168.10.10"

不确定这是否能解决您的问题。不过值得一试

【讨论】:

    猜你喜欢
    • 2016-08-24
    • 1970-01-01
    • 2016-07-26
    • 1970-01-01
    • 1970-01-01
    • 2013-03-27
    • 2020-05-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多