MySQL Replication

Setting MySQL Master

  1. Modify my.cnf (usually located in /etc/mysql/my.cnf)
    1. Update bind-address entry from to the regular IP
      • bind-address =
      • bind-address =
    2. Set server-id to 1
    3. Uncomment the line with log_bin
    4. Designate the database to be replicated on to the slave server
      • binlog_do_db = db_to_replicate
    5. Save my.cnf and restart mysql
  2. Grant privileges to the slave (mysql command line)
    • GRANT REPLICATION SLAVE ON *.* to ‘slave_user’@’%’ IDENTIFIED BY ‘password’;
  3. ss

Setting MySQL Slave

  1. Modify my.cnf
    1. Set server-id to 2
    2. relay-log = /var/log/mysql/mysql-relate-bin.log (need to be added manually)
    3. log_bin = /var/log/mysql/mysql-bin.log
    4. binlog_do_db = <newdatabase>
  2. Set pw

– manzoor

Related Reading

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s