mysql5.5自动部署

2018-03-08  本文已影响3人  Ze_phyr

#!/bin/bash

#根据网络状况,判断安装方式

ping www.baidu.com -c 3 &> /dev/null

if [ $? == 0 ];then

yum -y install yum-utils &> /dev/null

wget -O mysqlrepo.rpm https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm &> /dev/null

rpm -Uvh mysqlrepo.rpm &> /dev/null

rm -rf mysqlrepo.rpm &> /dev/null

yum-config-manager --disable mysql57-community &> /dev/null

yum-config-manager --enable mysql55-community &> /dev/null

yum clean all &> /dev/null yum makecache &> /dev/null

yum -y install mysql-community-server &> /dev/null

if [ $? == 0 ];then

echo '在线版安装完成'

else

echo '在线版安装失败'

fi

else

tar xf MySQL*tar &> /dev/null

rpm -Uvh *rpm &> /dev/null

if [ $? == 0 ];then

echo '本地版安装完成'

rm -rf MySQL*

else

echo '本地版安装失败'

fi

fi

上一篇下一篇

猜你喜欢

热点阅读