I am running Laravel on Vagrant and I am trying to connect Sequel Pro.
I have just started using Vagrant, I have followed a few tutorials on connecting to Sequel Pro however they were all unsuccessful.
Here is my Vagrant file:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure('2') do |config|
config.vm.hostname = 'laravel'
config.vm.boot_timeout = 3600
config.vm.box = 'debian-73-i386-virtualbox-puppet'
config.vm.box_url = 'http://puppet-vagrant-boxes.puppetlabs.com/debian-73-i386-virtualbox-puppet.box'
config.vm.network :forwarded_port, guest: 8000, host: 8000
config.vm.network :forwarded_port, guest: 8500, host: 8500
config.vm.provider :virtualbox do |vb|
vb.customize ['modifyvm', :id, '--memory', '1536']
end
config.vm.provision :puppet do |puppet|
puppet.manifests_path = 'puppet/'
puppet.manifest_file = 'init.pp'
puppet.module_path = 'puppet/modules/'
# puppet.options = '--verbose --debug'
end
end
From my.cnf
:
bind-address = 127.0.0.1
Here is my /etc/hosts
127.0.0.1 localhost
127.0.1.1 laravel
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
EDIT: changed bind address to 0.0.0.0 still does not work In Sequel Pro I have
MySQL Host: 0.0.0.0
username: root
Password: (mysql password)
SSH Host 0.0.0.0
SSH User: vagrant
SSH Password: vagrant
EDIT: Here is my vagrant hosts file - etc/hosts
This is my hosts file
127.0.0.1 localhost
127.0.1.1 laravel
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
All the above answers didn't work for me until I have tried this:
vagrant ssh
passwd
to set a new password. Use passwordvagrant
for consistency.It will connect easily after that steps taken.
Thanks to @hugo at How do I Sequel Pro with PuPHPet?
The answer about the bind-address is right, however I have found that instead of changing the value to 0.0.0.0, it's better to just edit the my.cnf file and comment out the bind-address altogether.
If you do that and then follow the rest of the original answer, you should be able to connect via sequel pro
The issue is that MySQL as you have it setup in
my.cnf
now can only connect vialocalhost
within the Vagrant server:To enable networking in MySQL, you should change that setting in
my.cnf
to:And then restart the MySQL service. Unsure of how that would happen in Vagrant, but in Ubuntu you would enter a command like this:
You might have to check your MySQL user permissions to ensure that the user within MySQL can actually be used from any IP address—sometimes they are set strictly to
localhost
or127.0.0.1
—as well.As explained in the official MySQL documentation:
That said, exposing MySQL—or any database server—to the world is not advisable. But is acceptable in a case of local development like this.
So if enabling MySQL networking is not an option, you can also use the built in SSH tunneling capabilities in Sequel Pro to connect to MySQL via SSH. Details on all of the different connection types are shown on the official Sequel Pro site here. But this screenshot sums it up nicely.
Basically you just set your
localhost
/127.0.0.1
MySQL info as you normally would. But you also add the SSH info you would use to SSH into your server. And Sequel Pro will use that SSH connection to tunnel in & connect to MySQL seamlessly. This might be the better way to handle instead of dealing with MySQL networking & user permission issues.For SSH tunneling in Sequel Pro you just need to do the following:
localhost
or127.0.0.1
Now here you set the SSH settings for your Vagrant install:
Below are my screenshot for vagrant connected using mysql workbench from MAC
this is my configration:
Vagrant machine default ssh user and ssh password all are vagrant.
Try https://github.com/AlexDisler/mysql-vagrant, it lets you connect without an ssh tunnel (check out install.sh for the specific settings).