DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป is a community of 966,904 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
makitosan
makitosan

Posted on

Vagrant MySQL Port Forwarding Configuration

  • 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
Enter fullscreen mode Exit fullscreen mode

MySQL (guest)

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

bind-address            = 0.0.0.0
Enter fullscreen mode Exit fullscreen mode

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;
Enter fullscreen mode Exit fullscreen mode

TEST

mysql -uroot -p
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

๐ŸŒš Life is too short to browse without dark mode