Skip to content

Instantly share code, notes, and snippets.

@baniol
Created June 30, 2015 12:47
Show Gist options
  • Save baniol/c6b81d79fab3f7638e37 to your computer and use it in GitHub Desktop.
Save baniol/c6b81d79fab3f7638e37 to your computer and use it in GitHub Desktop.
mysql provision
yum list installed "mysql-server" > /dev/null>&1
if [[ $? -ne 0 ]]; then
echo " >>> Install mysql-server"
yum install -y mysql-server
fi
yum list installed "mysql" > /dev/null>&1
if [[ $? -ne 0 ]]; then
echo " >>> Install mysql"
yum install -y mysql
fi
chkconfig --levels 235 mysqld on
service mysqld start
mysql -uroot << EOF
CREATE USER "myuser"@"localhost" IDENTIFIED BY "test";
GRANT ALL PRIVILEGES ON *.* TO "myuser"@"localhost" IDENTIFIED BY "test";
FLUSH PRIVILEGES;
create database loadtest;
use loadtest;
source /root/Projects/provision/customer.sql;
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment