Created
June 18, 2016 07:38
-
-
Save jfengq/5ff05c75c18a137c11dcda51945bbb21 to your computer and use it in GitHub Desktop.
connect mysql outside vagrant box
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.修改vagrant配置文件 | |
Vagrant.configure(2) do |config| | |
... | |
config.vm.network "forwarded_port", guest: 3306, host: 3306 | |
... | |
end | |
2.修改vagrant box中mysql配置文件 | |
sudo sed -i 's/bind-address.*/bind-address = 0.0.0.0/' /etc/mysql/my.cnf sudo service mysql restart | |
3.connect | |
Connection Method: Standard TCP/IP over SSH | |
SSH Hostname: 127.0.0.1:2222 | |
SSH Username: vagrant | |
SSH Key File: /.vagrant/default/virtualbox/private_key | |
MySQL Hostname: 127.0.0.1 | |
MySQL Server Port: 3306 (or whatever port you forwarded to) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment