Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect to MySQL on Vagrant instance with Sequel Pro

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
like image 981
user3692109 Avatar asked May 30 '14 16:05

user3692109


1 Answers

All you need to do is edit the bind address located here:

$ sudo nano /etc/mysql/my.cnf

Find the bind_address setting which will be set to 127.0.0.0 and change it to 0.0.0.0

After that restart mySQL:

$ sudo service mysql restart

The final step is just updating permissions:

$ mysql -u root -proot -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION; FLUSH PRIVILEGES;"

Then connect as you normally would (changing port to what ever you set in your vagrant file).

sequel pro settings

Note there are security issues here since it's all pretty open but for dev work it's fine.

like image 144
mylesthe.dev Avatar answered Sep 22 '22 20:09

mylesthe.dev