shell脚本部署mysql
[root@129-master ~]# vim renweiwei.sh
#!/bin/bash
#关闭防火墙和selinux
systemctl stop firewalld
systemctl disable firewalld &> /dev/null
setenforce 0
#部署yum源
#到阿里云源查找centos镜像
#curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/rep o/Centos-vault-8.5.2111.repo
#yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noar ch.rpm
#sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors. aliyun.com|' /etc/yum.repos.d/epel*
#sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
#安装依赖包
echo "正在安装依赖包"
yum -y install libncurses* &> /dev/null
echo "安装完成"
#创建mysql用户
echo "正在创建mysql用