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 ****
server-id=4745869
log-bin=mysql-bin
log-error=mysql-bin.err
binlog_do_db=saggezza_cats,saggezza_catstesting
# ***** Till Here ****
Here are Ignoring all the DBs for Replication except the two above.
Go to /opt/lampp/etc/my.cnf
Added the lines as I mentioned above above. Also Make sure “max_allowed_packet = 16M”
Make sure to comment out he existing server-id as we have already given above.
Restart XAMPP
$ 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.
server-id=9384593
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.
/opt/lampp/var/mysql/mysql-bin
Now we can see all the DBs in Replication Mode. Now any Updates to Master will reflect on the slave.
This will have the MASTER-SLAVE for Mysql Server is Ready.
nicely done sir great help
ReplyDeletebut how to check weather replication is working or not
Thank you very much! For some reason I couldn't get this to work, but following your directions helped and now it's fully functional :D
ReplyDeleteHi, I was able to complete the process and all table struture were copied but not the data inside each table. Do u have any suggestion of how to fix it?
ReplyDeleteNOTE: 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.
ReplyDelete>>> Where are its logs?
copied
ReplyDeletehttp://ahmedzubayr.wordpress.com/2012/04/24/configure-master-slave-replication-mysql-xampp/
nice Santosh Sarkar but if i tried in on cpanel then there is no option about replication
ReplyDeletecheck in more tab
Deletehow do i undo my confeguration (master to normal)
ReplyDeleteI want replication on same server as master and slave...
ReplyDeleteIs it possible then reply me on mail parsaniyaparth@gmail.com
Sir,
ReplyDeleteThank you so much. You saved me not to be run by the day :)
Unable to view screenshots. Getting No Permission message
ReplyDeleteVery informative site and article about the real time file replication i must bookmark it and keep posting interesting articles.
ReplyDeletereal time sync software