Skip to content

Instantly share code, notes, and snippets.

@OSMeteor
Last active April 14, 2019 05:36
Show Gist options
  • Save OSMeteor/b6f1a4cb3ccfdcf85560d2fcb0826e5e to your computer and use it in GitHub Desktop.
Save OSMeteor/b6f1a4cb3ccfdcf85560d2fcb0826e5e to your computer and use it in GitHub Desktop.
show processlist;
show master status;
show slave status\G;
stop slave;
change master to master_auto_position=0;
change master to master_host='x.x.x.x',master_user='root',master_password='***', master_log_file='mysql-bin.004672',master_log_pos=63057965;
start slave;
set global sql_slave_skip_counter=1;
set global gtid_purged='3310b4c5-1dd6-11e7-b2b0-00163e1a4cc2:1-21539393';
/usr/local/mysql/bin/mysqlbinlog --no-defaults -v -v --base64-output=DECODE-ROWS mysql-bin.004671 | grep -A '10' 90819758
/usr/local/mysql/bin/mysqlbinlog -v --stop-position=/var/log/mysql/mysql-bin.004671> /opt/f.log
cat /var/log/mysql/mysql-bin.004671 | awk '/end_log_pos 19688916/ {print NR}'
GRANT ALL ON *.* TO 'root'@'%';
alter user 'root'@'localhost' identified with mysql_native_password by '123456';
flush privileges;// 刷新配置
[mysqld]
slave_skip_errors=1032,1064 同步自动跳过更新,与主键冲突错误。
## not allowed to connect
mysql -h localhost -u root -p //这样应该可以进入MySQL服务器
select host from user where user='root';
update user set host = '%' where user ='root';
flush privileges; //修改生效
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment