Skip to content

Instantly share code, notes, and snippets.

@twelvejie
Last active May 10, 2024 05:23
Show Gist options
  • Save twelvejie/b83a52b4a7682f8c0b9c2aba4d8d45e0 to your computer and use it in GitHub Desktop.
Save twelvejie/b83a52b4a7682f8c0b9c2aba4d8d45e0 to your computer and use it in GitHub Desktop.

mysql主从配置

配置主库

1.创建账号
GRANT REPLICATION SLAVE ON *.* TO 'replica_user'@'replica_server_ip';
FLUSH PRIVILEGES;

配置从库

1.配置同步点
STOP SLAVE;
CHANGE MASTER TO MASTER_HOST ='your-master-ip', MASTER_USER ='replication_user', MASTER_PASSWORD ='password', MASTER_LOG_FILE = 'mysql-bin.000001', MASTER_LOG_POS = 900;

问题

1. 删除了同步点,从旧的binlog点开始同步,需要跳过的报错(从库)
[mysqld]
slave-skip-errors=1062,1032
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment