DEV Community

makitosan
makitosan

Posted on

3 1

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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay