LoginSignup
7
7

More than 5 years have passed since last update.

IntelliJ IDE系でvagrant上のmysqlを指定する

Posted at

Introduction

毎回やり方確認するのが面倒なので

How to

  1. IntelliJ IDEを起動 2.[database] => [+] => [Data Source] => [mysql] を選択
  2. 各種設定を書く <= ここについて書いてます
  3. Test Connectionで確認
  4. 完了

設定ファイル

GeneralSSH/SSL に記述を行う必要があります.

# General

こちらは特に問題ないと思います.

Key Value Comment
Host localhost or 127.0.0.1
port 3306
Database Your database name
User User name to access mysql
Password Password of user name
URL - ここは触る必要なし

# SSH/SSL

曲者

Use SSH tunnel にチェックを入れる

この時点で恐らくvagrant upを実行していると思うので以下のコマンドを実行

$ vagrant ssh-config
Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /[your file path]/.vagrant/machines/default/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL

Key Value Comment
Proxy host 192.168.33.10 Vagrantfile の config.vm.network "private_network"を見て
port 22
Proxy user vagrant ssh-configのUser
Auth type Key pair(OpenSSH or PuTTY)
Private key file /[your file path]/.vagrant/machines/default/virtualbox/private_key vagrant ssh-configのIdentifyFileのパスを参照してください

最後に Test Connection が Successful になればOK

Comments

Private key fileCommand + Shift + g/[your file path]/.vagrant/を入力してあとは下層まで辿って行ってください.

7
7
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7