Introduction
毎回やり方確認するのが面倒なので
How to
- IntelliJ IDEを起動
2.[database] => [+] => [Data Source] => [mysql] を選択 - 各種設定を書く <= ここについて書いてます
- Test Connectionで確認
- 完了
設定ファイル
General と SSH/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 fileはCommand + Shift + gで/[your file path]/.vagrant/を入力してあとは下層まで辿って行ってください.