Skip to content

Instantly share code, notes, and snippets.

@mesaque
Last active May 15, 2016 16:48
Show Gist options
  • Save mesaque/18b7c23319abf82488342963b0ddd4a6 to your computer and use it in GitHub Desktop.
Save mesaque/18b7c23319abf82488342963b0ddd4a6 to your computer and use it in GitHub Desktop.
Mysql Replication resume
### Creating a User for Replication(Each slave connects to the master using a MySQL user name and password, so there must be a user account on the master that the slave can use to connect)
CREATE USER 'replication_server1'@'172.17.0.%' IDENTIFIED BY '084T92x0x0B998M';
GRANT REPLICATION SLAVE ON *.* TO 'replication_server1'@'172.17.0.%';
## Server-id on master my.conf
[mysqld]
server-id = 10
log-bin = mysql-bin
#copy the print
SHOW MASTER STATUS\G
## Server-id on slave my.conf
[mysqld]
server-id = 2
log-bin = mysql-bin
relay_log = /var/lib/mysql/mysql-relay-bin
log_slave_updates = 1
read_only = 1
##Add my.conf SLAVE
CHANGE MASTER TO MASTER_HOST = "172.17.0.2", MASTER_PORT = 3306, MASTER_USER = "replication_server1", MASTER_PASSWORD = "084T92x0x0B998M", MASTER_LOG_FILE="mysql-bin.000001", MASTER_LOG_POS=0;
START SLAVE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment