Setting MySQL Master
- Modify my.cnf (usually located in /etc/mysql/my.cnf)
- Update bind-address entry from 127.0.0.1 to the regular IP
bind-address = 127.0.0.1- bind-address = 123.234.12.13
- Set server-id to 1
- Uncomment the line with log_bin
- Designate the database to be replicated on to the slave server
- binlog_do_db = db_to_replicate
- Save my.cnf and restart mysql
- Update bind-address entry from 127.0.0.1 to the regular IP
- Grant privileges to the slave (mysql command line)
- GRANT REPLICATION SLAVE ON *.* to ‘slave_user’@’%’ IDENTIFIED BY ‘password’;
- FLUSH PRIVILEGES;
- ss
Setting MySQL Slave
- Modify my.cnf
- Set server-id to 2
- relay-log = /var/log/mysql/mysql-relate-bin.log (need to be added manually)
- log_bin = /var/log/mysql/mysql-bin.log
- binlog_do_db = <newdatabase>
- Set pw
– manzoor
Related Reading