Update July 19, 2014:
The default MySQL Server package in the CentOS repo is ridiculously old (5.1 - MyIASM is the default storage engine). If you need the newest version of MySQL, there is an RPM for the Oracle YUM Repo which will provide you the latest packages. I can't provide you that here because you have to accept Oracles Terms of Service agreement (sorry).
I needed a quick and minimal MySQL box to use for some development work. I didn't want this box to be laden with a full LAMP stack (plus a myriad of other tools PHP'ers seem to need in their endeavors). Unfortunately, I didn't find one. This forced me to create one, which I share with you now.
The Vagrant file is simple:
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "2creatives-centos64"
config.vm.box_url = "https://github.com/2creatives/" +
config.vm.network "forwarded_port", guest: 3306, host: 3306
config.vm.network "private_network", ip: "192.168.24.42"
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
config.vm.provision "ansible" do |ansible|
ansible.playbook = "playbook.yml"
ansible.verbose = "vv"
ansible.sudo = true
And the playbook:
- hosts: all
- name: Install MySQL
yum: name=mysql-server state=installed
- name: Install MySQL-python
yum: name=MySQL-python state=installed
- name: Ensure MySQL is running
service: name=mysqld state=started enabled=true
- name: Ensure IPTables is not running
service: name=iptables state=stopped enabled=false
- name: Copy the my.cnf
copy: src=my.cnf dest=/root/.my.cnf owner=root mode=0600
- name: Update MySQL Root Password
mysql_user: name=root host=$item password=$root_db_password
- name: Annonymous Users not in MySQL
mysql_user: name='' host=$item state=absent
- name: Test Database is Removed
mysql_db: name=test state=absent
And finally, you will notice we are copying a local instance of
my.cnf to the virtual machine:
As I said, it's very minimal.
You can clone the deployment from this repository: https://github.com/rclayton/vagrant-mysql
Also, I want to thank Lorin Hochstein for a portion of the Ansible config (particularly saving me some time on removing some of the default gruff.
Unrepentant Thoughts on Software and Management.