i had 2 databases, one run in my localhost which is offline and another is in server which is online, and what i want is after i insert some data in my localhost offline, i can click a button in my offline which is sync the database and update it on the server database which is online, and anyone of you know how to do it? Im new in php and mysql, hope you all can help, thanks!!
1 Answer
Doing synchronization like this is, I'm sorry to say, not a beginner activity.
If you were more experienced I would recommend things like a transaction table - where you record each action, then replay it on the server (aka slave).
MySQL can also do that automatically see: http://dev.mysql.com/doc/refman/5.0/en/replication.html
But none of it is simple to setup.
If you don't mind deleting and recreating the database fresh each time, then you maybe be able to use mysqldump to create a full export of your database, then load it on the server.
8 Comments
newbie
did the replication is php based? and how it code? when i saw read the link you gave, i have no idea how to setup and start T.T
Ariel
No, the replication is not php. It's internal to MySQL. Setting it up is long and complicated, sorry, but you will simply have to learn it. You can also try google for some tutorials: google.com/search?q=setting+up+mysql+replication
newbie
thanks again, what the different between synchronization and replication? replication can function while offline? because what i want is just update one table in database from local to master server
Ariel
Synchronization is two way, replication is one way. Replication is much easier.
newbie
what i read is replication can just insert data on master server and slave just can read cannot insert? is this true? because i want to let both can insert new data.
|