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