【问题标题】:Connect to DB through Vagrant using RubyMine使用 RubyMine 通过 Vagrant 连接到 DB
【发布时间】:2015-01-25 03:35:21
【问题描述】:

我刚开始研究一个通过 Vagrant 建立的 ruby​​ 项目。我已成功让远程解释器工作,但我无法连接到数据库。

这是我的Vagrantfile:

# This Vagrantfile is for development use only.
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "markusproject/ubuntu"

  # Allow instance to see project folder.
  # Warning: This may cause problems with your Vagrant box!
  #          Enable at your own risk.
  # config.vm.synced_folder ".", "/home/vagrant/Markus"

  # Access the server running on port 3000 on the host on port 42069.
  # config.vm.network "forwarded_port", guest: 3000, host: 42069
  config.vm.network :private_network, ip: '192.168.50.50'
  config.vm.synced_folder '.', '/home/vagrant/Markus', nfs: true

  config.vm.provider "virtualbox" do |vb|
    # Uncomment the following line if you want a GUI.
    # vb.gui = true
    vb.name = "markus"
  end
end

我已将 VM 设置为 use NFS。这是vagrant ssh-config的输出:

Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /Users/paymahn/.vagrant.d/insecure_private_key
  IdentitiesOnly yes
  LogLevel FATAL

我保留了数据库连接的默认设置,但尝试了几种为连接设置 SSH 隧道的变体。

这些变体包括:

  1. 将代理主机设置为 127.0.0.1
  2. 将端口设置为 2222
  3. 将代理主机设置为 192.168.50.50
  4. 将端口设置为 22

当我测试连接时,所有变体都导致连接失败。任何有关设置此配置的帮助将不胜感激!

【问题讨论】:

  • 截图来自 Mac,看来您使用 vagrant 实例(一个 ruby​​ 客户端)作为代理服务器从您的 Mac 笔记本电脑连接数据库。但那是另一回事,您是否正确设置了代理服务器?连接数据库的设置应该直接从 vagrant 实例完成。
  • 我不太清楚你的意思。在我看来,我需要配置 Rubymine 才能从中成功访问数据库。你知道我必须做什么才能成功连接到数据库吗?

标签: database vagrant pycharm rubymine rubymine-7


【解决方案1】:

嗯...感谢this guy。

以下是最终对话框的外观:

我对@9​​87654324@ 数据库做了完全相同的事情,只是我将数据库名称从markus_development 更改为markus_test

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-04-05
    • 2020-04-08
    • 1970-01-01
    • 2017-03-16
    • 2016-08-13
    • 1970-01-01
    • 2015-12-17
    • 2015-04-12
    相关资源
    最近更新 更多