Hoppa till huvudinnehåll

Den här sidan använder cookies. Om du fortsätter använda sidan så accepterar du användandet av cookies. Läs mer om cookies

Jag förstår

Connect MySQL Workbench or Sequel Pro to Vagrant via SSH

Using a tool like Workbench or Sequal Pro helps you when working with the database. So it's really nice to let that application connect to you vagrant machine where the mysql server is running. To do that you need the application to connect through an ssh tunnel. So here's is how.

In the project folder where you normally execute vagrant up (where your Vagrantfile is located) do

vagrant ssh-config 

to list your configuration.

In my case it gave me this output:

User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /your-local-project-folder/.vagrant/machines/default/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes

So here you can see that Vagrant is using private_key file for authentication. To test this you can try in you terminal to

ssh -i .vagrant/machines/default/virtualbox/private_key vagrant@INTERNAL-BOX-IP

 this instead of the normal command vagrant ssh witch works without the key file flag.

No you can configure your mysql application using:

SSH Username: vagrant
SSH Password: vagrant
SSH Key File: local-project-folder/.vagrant/machines/default/virtualbox/private_key
MySQL Hostname:
MySQL Server Port: 3306
Username: Database username in my case "root"
Password: Database user password in my case "password"

and your done.

Vi hjälper dig nå resultat. Kontakta oss Ring direkt på 08-20 90 04.