#!/bin/bash
cd /usr/local/package
yum remove -y mysql-libs-5.1.73-8.el6_8.x86_64
rpm -ivh mysql-community-common-5.7.23-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.23-1.el6.x86_64.rpm
rpm -ivh mysql-community-client-5.7.23-1.el6.x86_64.rpm
rpm -ivh mysql-community-server-5.7.23-1.el6.x86_64.rpm
grep 'temporary password' /var/log/mysqld.log
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Banban_123456';
CREATE USER 'backup'@'172.16.0.242' IDENTIFIED BY 'Banban_123456';
GRANT REPLICATION ON *.* TO 'backup'@'172.16.0.242';
grant all privileges on *.* to 'backup1'@'172.16.0.243' identified by 'Banban_123456' with grant option;
grant all privileges on *.* to 'backup2'@'172.16.0.244' identified by 'Banban_123456' with grant option;
flush privileges;
CHANGE MASTER TO MASTER_HOST='172.19.46.9', MASTER_USER='backup', MASTER_PASSWORD='Q`W1E2R3T4Kuxiu2018~!@#$', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=6725;