Code in this video: How to Configure MySQL Master-Master Replication on Ubuntu
📌 Note: Replace the orange-highlighted information with your own details. ✳️ on Master Server 1 ### # Unique ID of the MySQL server. # This ID can not be re-used in any nodes in the cluster. server-id = 1 ### # IP of the Master Server 1 bind-address = IP-of-Master-Server-1 ### # Hostname of the Master Server 1 report_host = Hostname-of-Master-Server-1 # This is the file in which all the replication information is stored. log-bin = /var/log/mysql/mysql-bin.log CREATE USER 'rep_user'@'%' IDENTIFIED BY 'rep_user_PWD'; ALTER USER 'rep_user'@'%' IDENTIFIED WITH mysql_native_password BY 'rep_user_PWD'; GRANT REPLICATION SLAVE ON *.* TO 'rep_user'@'%'; FLUSH PRIVILEGES; CHANGE MASTER TO MASTER_HOST='IP_of_Master_Server_2', MASTER_USER='Database-User', MASTER_PASSWORD='Database-Password', MASTER_LOG_FILE='Log_file_on_Master_Server_2', MASTER_LOG_POS=Log_Position_on_Master_Server_2; ✳️ on Master Server 2 ### # Unique ID of the MySQL server. # This ID can not be re-used in any nodes in the cluster. server-id = 1 ### # IP of the Master Server 1 bind-address = IP-of-Master-Server-2 ### # Hostname of the Master Server 1 report_host = Hostname-of-Master-Server-2 # This is the file in which all the replication information is stored. log-bin = /var/log/mysql/mysql-bin.log CREATE USER 'rep_user'@'%' IDENTIFIED BY 'rep_user_PWD'; ALTER USER 'rep_user'@'%' IDENTIFIED WITH mysql_native_password BY 'rep_user_PWD'; GRANT REPLICATION SLAVE ON *.* TO 'rep_user'@'%'; FLUSH PRIVILEGES; CHANGE MASTER TO MASTER_HOST='IP_of_Master_Server_1', MASTER_USER='Database-User', MASTER_PASSWORD='Database-Password', MASTER_LOG_FILE='Log_file_on_Master_Server_1', MASTER_LOG_POS=Log_Position_on_Master_Server_1;