bashで書きました。まだ、無駄な部分もありますが、ご容赦をお願いします。
#!/bin/sh IFS=$'\n' SCRIPT_PATH=`echo $(cd $(dirname $0);pwd)` source ${SCRIPT_PATH}/../config.sh source ${SCRIPT_PATH}/../common.sh yum-config-manager --disable mysql55-community yum-config-manager --disable mysql56-community yum-config-manager --enable mysql57-community-dmr yum -y install http://dev.mysql.com/get/mysql57-community-release-el6-7.rpm yum repolist enabled | grep "mysql.*-community.*" yum info mysql-community-server yum -y install mysql-community-devel mysql-community-server cp_template mysql/my57.cnf /etc/my.cnf usermod -s /sbin/nologin mysql if [ ! -d /var/log/mysql ]; then mkdir /var/log/mysql chown -R mysql: /var/log/mysql fi yum repolist all | grep mysql service mysqld start chkconfig mysqld on echo "\q" | mysql -uroot if [ $? -eq 0 ]; then MYSQL_ROOT_PASS=`get_or_create_password MYSQL_ROOT_PASS` echo "UPDATE mysql.user SET Password=PASSWORD('${MYSQL_ROOT_PASS}') WHERE User='root';" | mysql -uroot echo "FLUSH PRIVILEGES;" | mysql -uroot #@ -p${MYSQL_ROOT_PASS} fi