MySQL5.7.20单实例二进制包安装方法(4)

/usr/local/mysql/bin/mysql -uroot -p -P3306 -S /gomeo2o/data/mysql/mysql_3306/tmp/mysql_3306.sock set sql_log_bin = 0; create user 'rpl_user'@'%'; grant replication slave on *.* to 'rpl_user'@'10.%' identified by 'BR8KLwXCKHgN'; update mysql.user set authentication_string=password('rootpwd2017') where user='root'; flush privileges; set sql_log_bin = 1; reset master ; reset slave all; exit;

 

######## 配置主从复制方法开始 ######## # CHANGE MASTER TO MASTER_HOST='172.16.1.10',MASTER_USER='rpl_user', # MASTER_PASSWORD='BR8KLwXCKHgN',MASTER_PORT=3306, # MASTER_CONNECT_RETRY=10,MASTER_AUTO_POSITION =1; # # start slave; # show slave status\G; ######## 配置主从复制方法结束 ########

2.12、设置便捷使用方式

/usr/local/mysql/bin/mysql_config_editor set --host=localhost --login-path=3306_localhost_login --user=root --port=3306 --password --socket=/gomeo2o/data/mysql/mysql_3306/tmp/mysql_3306.sock # 请输入root密码: rootpwd2017 alias mysql.3306.start='/usr/local/mysql/bin/mysqld_safe --defaults-file=/gomeo2o/data/mysql/mysql_3306/my_3306.cnf &' alias mysql.3306.stop='/usr/local/mysql/bin/mysqladmin --defaults-file=/gomeo2o/data/mysql/mysql_3306/my_3306.cnf --login-path=3306_localhost_login shutdown &' alias mysql.3306.login='/usr/local/mysql/bin/mysql --defaults-file=/gomeo2o/data/mysql/mysql_3306/my_3306.cnf --login-path=3306_localhost_login' # alias mysql.3306.all_dump='/usr/local/mysql/bin/mysqldump --defaults-file=/gomeo2o/data/mysql/mysql_3306/my_3306.cnf --login-path=3306_localhost_login -R -E --triggers -e --max_allowed_packet=16777216 --net_buffer_length=16384 --default-character-set=utf8mb4 --set-gtid-purged=OFF --master-data=2 --single-transaction --all-databases --quick | gzip >/data/backup/all_database_bak_`date +%Y-%m-%d_%H_%M_%S`.sql.gz' cat >>/root/.bashrc <<EOF alias mysql.3306.start='/usr/local/mysql/bin/mysqld_safe --defaults-file=/gomeo2o/data/mysql/mysql_3306/my_3306.cnf &' alias mysql.3306.stop='/usr/local/mysql/bin/mysqladmin --defaults-file=/gomeo2o/data/mysql/mysql_3306/my_3306.cnf --login-path=3306_localhost_login shutdown &' alias mysql.3306.login='/usr/local/mysql/bin/mysql --defaults-file=/gomeo2o/data/mysql/mysql_3306/my_3306.cnf --login-path=3306_localhost_login' # alias mysql.3306.all_dump='/usr/local/mysql/bin/mysqldump --defaults-file=/gomeo2o/data/mysql/mysql_3306/my_3306.cnf --login-path=3306_localhost_login -R -E --triggers -e --max_allowed_packet=16777216 --net_buffer_length=16384 --default-character-set=utf8mb4 --set-gtid-purged=OFF --master-data=2 --single-transaction --all-databases --quick | gzip >/data/backup/all_database_bak_`date +%Y-%m-%d_%H_%M_%S`.sql.gz' EOF source /root/.bash_profile cat >>/etc/rc.local <<EOF # alias mysql.3306.start='/usr/local/mysql/bin/mysqld_safe --defaults-file=/gomeo2o/data/mysql/mysql_3306/my_3306.cnf &' # alias mysql.3306.stop='/usr/local/mysql/bin/mysqladmin --defaults-file=/gomeo2o/data/mysql/mysql_3306/my_3306.cnf --login-path=3306_localhost_login shutdown &' # alias mysql.3306.login='/usr/local/mysql/bin/mysql --defaults-file=/gomeo2o/data/mysql/mysql_3306/my_3306.cnf --login-path=3306_localhost_login' ## alias mysql.3306.all_dump='/usr/local/mysql/bin/mysqldump --defaults-file=/gomeo2o/data/mysql/mysql_3306/my_3306.cnf --login-path=3306_localhost_login -R -E --triggers -e --max_allowed_packet=16777216 --net_buffer_length=16384 --default-character-set=utf8mb4 --set-gtid-purged=OFF --master-data=2 --single-transaction --all-databases --quick | gzip >/data/backup/all_database_bak_`date +%Y-%m-%d_%H_%M_%S`.sql.gz' EOF

3、gtid故障处理一例

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/786f178992a869c0915d12c42f5711bf.html