本地安装mysql脚本
Posted 莫孟林
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了本地安装mysql脚本相关的知识,希望对你有一定的参考价值。
[[email protected] ~]# vim mysql_install.sh
#!/usr/bin/env bash
#mysql install 2
#by tianyun
#yum 配置yum源
$ip rm –rf /etc/yum.repos.d/*
wget ftp://172.16.8.100/yumrepo/centos7.repo -P /etc/yum.repos.d/
wget ftp://172.16.8.100/yumrepo/mysql57.repo -P /etc/yum.repos.d/
yum –y install lftp vim-enhanced bash-completion
#scp –r centos7.repo [email protected]$ip:/etc/yum.repos.d/
#关闭防火墙和selinux
#Firewalld & SElinux
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed –ri ‘/^SELINUX/cSELINUX=disabled’ /etc/selinux/config
#设置时钟
#ntp
yum –y install chrony
sed –ri ‘/3.centos/aserver 172.16.8.100 iburst’ /etc/chrony.conf
#启动时钟服务
systemctl start chronyd
systemctl enable chronyd
#install mysql5.7
yum –y install mysql-community-server
#启动mysql
systemctl start mysqld
systemctl enable mysqld
grep ‘temporary password’ /var/log/mysqld.log | awk ‘{print $NF}’ > /root/mysqloldpass.txt
#改mysql的初始密码
mysqladmin –uroot –p’`cat /root/mysqloldpass.txt`’ password ‘(TianYunYang123)
以上是关于本地安装mysql脚本的主要内容,如果未能解决你的问题,请参考以下文章
shell脚本专题之-----------全自动编译安装mysql