DEV Community

loading...

Vagrant MySQL Port Forwarding Configuration

makitosan profile image makitosan ・1 min read
  • Ubuntu 16.04
  • MySQL 5.7
  • Vagrant 2.0.2

VAGRANT

EDIT Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.network "forwarded_port", guest: 3306, host: 3306
end

MySQL (guest)

EDIT /etc/mysql/mysql.conf.d/mysqld.cnf

bind-address            = 0.0.0.0

GRANT PRIVILEGES

On the guest machine, login to local mysql server and execute the following sqls.

GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.0.2.2' IDENTIFIED BY 'your_password' WITH GRANT OPTION;
FLUSH PRIVILEGES;

TEST

mysql -uroot -p

Discussion (0)

pic
Editor guide