Skip to content

Instantly share code, notes, and snippets.

@nimzo6689
Created May 7, 2017 22:28
Show Gist options
  • Save nimzo6689/ee64d7f0c0a546e4697b6953a748fd58 to your computer and use it in GitHub Desktop.
Save nimzo6689/ee64d7f0c0a546e4697b6953a748fd58 to your computer and use it in GitHub Desktop.
Vagrant + CentOS7 + MySQLのプロビジョニング(Bash)
Vagrant.configure("2") do |config|
config.vm.box = "bento/centos-7.3"
config.vm.network "private_network", ip: "192.168.33.12"
######################################
script = <<SCRIPT
yum -y remove mariadb-libs
rm -rf /var/lib/mysql
yum -y localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum -y install mysql-community-server
systemctl enable mysqld
systemctl start mysqld
echo << EOM >> /etc/my.cnf
character-set-server = utf8
default_password_lifetime = 0
EOM
password=`cat /var/log/mysqld.log | grep password | tr ' ' '\n' | tail -n1`
#mysql -u root -p${password}
SCRIPT
######################################
config.vm.provision :shell, :privileged => true, :inline => script
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment