Skip to content

Instantly share code, notes, and snippets.

@kovid-rathee
Created July 13, 2019 07:31
Show Gist options
  • Save kovid-rathee/a36f9f204fc10787a44007706c0ba5e0 to your computer and use it in GitHub Desktop.
Save kovid-rathee/a36f9f204fc10787a44007706c0ba5e0 to your computer and use it in GitHub Desktop.
Setting up MySQL Replication from Scratch on two instances of MySQL Server
# Run on Master
# Replace slave-ip and master-ip with actual ip addresses of those machines
CREATE USER repl;
GRANT REPLICATION SLAVE ON *.* TO repl_user@'slave-ip' IDENTIFIED BY 'passwd';
# Run on Slave
CHANGE MASTER TO MASTER_HOST = 'master-ip', MASTER_PORT = 3306, MASTER_USER = 'repl', MASTER_PASSWORD = 'passwd';
START SLAVE;
# To check the Status of Replication
SHOW SLAVE STATUS;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment