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