Skip to content

jazzfog/MySql-in-Vagrant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MySQL with persistent data inside VM provisioned with Vagrant

This project contains Vagrant config file and couple of bash scripts which will create virtual machine containing MySQL with data files located in synced folder on host machine.

It means you can vagrant destroy and vagrant up as many times as you need and MySQL data will still be there.

This project features

  • Virtual machine, provisioned with help of Vagrant, containing MySQL.
  • MySQL install in non-interactive mode.
  • As said above, the MySQL data is persistent - you can destroy and re-create VM without losing the data in your DB.
  • Setup of access to your MySQL server from host machine.
  • Apt-get update and dist-upgrade in non-interactive mode.

How to use

  1. Install VirtualBox virtualizer so you could run virtual machines on your desktop.
  2. Install Vagrant provisioner so you could create VMs in easier way.
  3. Get this project files by cloning with git executing git clone https://github.com/jazzfog/mysql-in-vagrant.git from console or just download zip file.
  4. Open directory with files in console and execute vagrant up.
  5. Just wait, in couple of minutes you will have fully functional MySQL server in virtual machine.
  6. Connect to it from your desktop using ip and port 192.168.100.120:3306 (you can change it in Vagrantfile). By default there is only user root with empty password.
  7. Log in into your VM with MySQL by running vagrant ssh in console from directory where project files are. Or you can use any ssh client you prefer and connect using ip and port 192.168.100.120:22, in this case use login vagrant and password vagrant to access VM.
  8. Connect to MySQL server from VM by running mysql -u root in console (no need to use key -p)
  9. If you need to add some configuration to MySQL server - edit provision/my.cnf file.
  10. If you need to run something every time VM boots - edit provision/up.sh file.

Facts

  • To connect use login root and empty password. You can create more users using it.
  • This instance supposed to be development environment. The fact that root password is empty should state it :)
  • However it may give you some ideas how to provision production server automatically.
  • The data (MySQL binary files are located in directory MysqlData inside project folder). After each start MySQL in VM will pickup those files.
  • If you want to reset data - just delete directory MysqlData. Usually you do not need to re-create VM but you can do it too.
  • Guest OS/box is "ubuntu/trusty64"
  • VM login and password are default for Vagrant: vagrant/vagrant.

About

MySQL with persistent data in Vagrant

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages