#!/bin/bash
#mysql的yum安装
cat <<eof
+++++++++++++++++++yum-mysql++++++++++++++++
==============================================
+++++++++++ 1.yum安装mysql +++++++++
+++++++++++ 2.退出 +++++++++
==============================================
eof
ping -c1 www.baidu.com &>/dev/null
if [ $? -eq 0 ];then
echo "你的网络正常,可以开始安装mysql"
else
echo "你的网络连接超时,请检查网络"
exit 2
fi
yum_mysql()
{
yum -y install wget &>/dev/null
wget /etc/yum.repos.d/ https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm &>/dev/null
cd /etc/yum.repos.d/
rpm -ivh mysql80-community-release-el7-3.noarch.rpm &>/dve/null
if [ $? -eq 0 ];then
echo "+++++++++++++++mysql的yum仓库已经安装成功++++++++++++++"
else
echo "===============mysql的yum仓库安装失败,请重新尝试============"
exit 3
fi
echo "-------------------查看所有关于mysql的库-----------------"
yum repolist all | grep mysql
echo "~~~~~~~~~开始安装mysql的辅助工具包~~~~~~~~~"
yum -y install yum-utils &>/dev/null
echo "————————————————开启5.7的版本,禁止8.0的版本————————————————"
yum-config-manager --enable mysql57-community
yum-config-manager --disable mysql80-community
echo "###########开始安装mysql,请小等片刻#############"
yum -y install mysql mysql-server
if [ $? -eq 0 ];then
echo "mysql安装成功"
else
echo "mysql安装失败,请检测你的环境"
exit 4
fi
}
mysql的yum安装
最新推荐文章于 2024-08-27 16:57:07 发布