centos7.3 shell安装mysql5.7.28

1.mysql源码包官网下载地址:

        https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar

2.看具体shell如下:

#!/bin/bash
install_mysql()
{
mkdir /usr/local/mysql
tar -xvf /root/mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar -C /usr/local/mysql/
cd /usr/local/mysql/
yum -y install mysql-community-*
sed -i '/^\[mysqld\]/a\log-bin=mysql-bin\nbinlog-format=ROW\nserver_id=1\nskip-grant-tables' /etc/my.cnf
systemctl enable mysqld
systemctl start mysqld
mysql -uroot -p"\n" -e "update mysql.user set authentication_string=password('$mysql_password') where user='root';"
sed -i '/^skip-grant-tables/d' /etc/my.cnf
systemctl restart mysqld

mysql --connect-expired-password -uroot -p${mysql_password} -e "alter user user() identified by '$mysql_password';"

}

mysql_ip="10.10.10.20"
mysql_password="Kz@163.com"
install_mysql

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值