Written by Agungadiariawan
Setting Master PC1 => edit file my.ini => tambahkan config dibawah ini log_bin_trust_function_creators=1 server-id = 1 log-bin = "C:/mysql_logs/mysql-bin" expire_logs_days = 10 max_binlog_size = 100M binlog_do_db = avr(namadb) slave-skip-errors=1062,1032 sync_binlog = 1 innodb_flush_log_at_trx_commit=1 binlog-format=mixed =>restart service mysql =>create user CREATE USER 'replication21'@'192.168.50.21' IDENTIFIED BY 'aSecUrEPa$$w0rd'; GRANT REPLICATION SLAVE ON *.* TO 'replication21'@'192.168.50.21'; FLUSH PRIVILEGES; *optional kunci databases FLUSH TABLES WITH READ LOCK; UNLOCK TABLES; => cek status runing master SHOW MASTER STATUS; =>dump atau backup full database mysqldump -u root -proot -h localhost --port=3307 --routines --events --database avr > C:\backupfull17122023.sql //Setting Slave PC2 => install mysql versi sama => import database mysql --user=root --port=3307 -p avr < C:\backupfull17122023.sql =>edit file my.ini server-id = 2 binlog-format = mixed log-bin = mysql-bin replicate-ignore-db=mysql relay-log = mysql-relay-bin log-slave-updates = 1 replicate-do-db=avr log_bin_trust_function_creators = 1 slave-skip-errors=1062 skip-slave-start =>restart service mysql =>hubungkan slave ke master CHANGE MASTER TO MASTER_HOST='192.168.50.20', MASTER_USER='replication21', MASTER_PASSWORD='aSecUrEPa$$w0rd', MASTER_PORT=3307, MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=107; =>start slave START SLAVE; =>cek status slave SHOW SLAVE STATUS; =>stop slave ketika mau mematikan service/ restart pc STOP SLAVE; =>reset slave STOP SLAVE;