使用RubyMine通过Vagrant连接到DB

时间:2015-01-17 21:12:58

标签: database vagrant pycharm rubymine rubymine-7

我刚刚开始研究通过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隧道的几种变体。

Database setup tab SSH Tunnel configuration

这些变化包括:

  1. 将代理主机设置为127.0.0.1
  2. 将端口设置为2222
  3. 将代理主机设置为192.168.50.50
  4. 将端口设置为22
  5. 当我测试连接时,所有变体都导致连接失败。任何有关设置此配置的帮助都将非常感谢!

1 个答案:

答案 0 :(得分:6)

嗯......我想通过this guy来解决这个问题。

以下是最终对话框的外观: Database tab SSH/SSL tab

我为test数据库做了完全相同的事情,除了我将数据库名称从markus_development更改为markus_test