代码拉取完成,页面将自动刷新
#!/bin/bash
rpm_mysql=`rpm -qa|grep mysql|wc -l`
Mysql_init=`ss -lntp|grep 3306|grep -v grep|wc -l`
Mysql_passwd=`grep "temporary password" /var/log/mysqld.log|awk -F "[ :]+" '{print $NF}'`
if [ $rpm_mysql -eq 0 ];then
echo "Mysql is not install..."
[ -d /home/packages ] || mkdir -p /home/packages
cd /home/packages && wget -q http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
rpm -ivh /home/packages/mysql57-community-release-el7-8.noarch.rpm
yum clean all && yum makecache
yum install mysql-community-server -y
if [ $Mysql_init -eq 0 ];then
systemctl start mysqld
systemctl status mysqld &>/dev/null
if [ $? -eq 0 ];then
echo "Mysqld is running..."
systemctl enable mysqld
mysqladmin -uroot "-p$Mysql_passwd" password "Xujun66207383!@#$"
exit 0
else
echo "Mysqld is no running"
exit 1
fi
fi
else
echo "Mysql is install..."
exit 0
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。