Configure Master / Slave Replication MySQL XAMPP
First Lets go to Replication panel on XAMPP.
Next Select Configure as Master
You can configure Replication as ALL or Selective. I have done selective where I select few DBs to Replicate.
Once you are done you need to add the lines below in the my.cnf file.
# ***** Added Lines here ****
# ***** Till Here ****
Go to /opt/lampp/etc/my.cnf
$ sudo ./opt/lampp/lampp restart
Once you restart XAMPP, you can see that Mysql Server is started as Master.
Next Lets Create a Replication user and give it privileges as the slave needs this information to connect to the Master.
I have given root but you can give any username you want.
MySQL Slave Configuration
First lets add Server-id to our slave as mentioned.
Now lets connect to Master.
You will get a confirmation about he successful connection to Master.
Now we need to start SLAVE I/O and Sql Threads.
They are right under “Control Slave” as below
Now you can see the threads running.
NOTE: If you face any issues getting the threads started then please check logs. In my case IO Thread was not starting. When I checked the log I found that I had two server-id’s in the my.cnf file. Also sometimes you will get IO error due to max_allowed_packet as well, as this is by default set to 1MB, which needs to be around 16MB.