我有簡單的無業遊民多機配置:如何允許遠程mysql登錄?
Vagrant.configure(2) do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.provision :shell, path: "vagrant/ubuntu-16.04/provision.sh"
config.vm.synced_folder "ed", "/var/www/html"
config.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 2
end
config.vm.define "node1", primary: true do |node|
node.vm.hostname = 'node1'
node.vm.network :private_network, ip: "192.168.56.101"
node.vm.network :forwarded_port, guest: 22, host: 10122, id: "ssh"
node.vm.provision :hosts, :sync_hosts => true
end
config.vm.define "node2" do |node|
node.vm.hostname = "node2"
node.vm.network :private_network, ip: "192.168.56.102"
node.vm.network :forwarded_port, guest: 22, host: 10123, id: "ssh"
node.vm.provision :hosts, :sync_hosts => true
end
end
在node1
我有PHP和node2
我有mysql。
當我運行mysql -uuser -ppass -P3306 -hlocalhost
從[email protected]
它的工作原理,
但當我嘗試從[email protected]
運行mysql -uuser -ppass -P3306 -h192.168.56.102
它不會工作,我得到錯誤:
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.56.102' (111)
我可以ping節點1,由節點,反之亦然。
@Vladimir,讓我知道你是否面臨任何問題。 :) –
非常感謝你!有用!!! –