Solved

cron job to automatically replicate remote mysql server database with local mysql running under mac os x (MAMP)

Posted on 2007-11-28
6
1,330 Views
Last Modified: 2013-11-12
I want to setup a cron job in my development mac os x running running MAMP (mac apache mysql php) to mirror myql database from remote host, say mysql.somesite.com:3306, to my local server localhost:8889.

1) frequent is about every 1 hour.
2) mirror only one database "mydatabase" with all it's tables and data

consider that remote access from my local ip is granted. and username password is username and password

THANKS  GURUs
0
Comment
Question by:aahmed753
  • 3
  • 2
6 Comments
 
LVL 20

Expert Comment

by:Muhammad Wasif
ID: 20367485
1 . Use mysqldump (command line untility) to get the whole database and import in your local machine

2. Consider the use of MySQL Replication http://dev.mysql.com/doc/refman/5.0/en/replication.html
0
 
LVL 43

Accepted Solution

by:
ravenpl earned 500 total points
ID: 20367684
And why will not You use mysql's build in replication?
http://www.howtoforge.com/mysql_database_replication
0
 

Author Comment

by:aahmed753
ID: 20367786
I HAVE ONE MORE QUESTION TO CLARIFY:

IF I MAKE CHANGES TO LOCAL DATABASE (ADD, DELETE, UPDATE) WILL THAT AFFECT THE REMOTE DATABASE? I REALLY DON'T WANT THAT.

Thanks.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 43

Expert Comment

by:ravenpl
ID: 20368282
I'm lost then. I got the impression, that You want to have backup database that is ready to connect in case of main base failed.

mirroring one database to another may be considered as replying all modifying queries from main to backup

that exactly what replication does.

And now You stating that You don't wan't that to happen on the backup database???
0
 

Author Comment

by:aahmed753
ID: 20368338
No, what i mean that I want only one-way replication... in another word it always replicates MAIN (REMOTE) to SLAVE (LOCAL), but NEVER from SLAVE TO MAIN.  so if in my local database by accident i remove something, next replication will always override that with MAIN server's copy.

Im not sure if that makes any sense.

Well, i guess my question remains: WILL CHANGE TO SLAVE MAKE CHANGE TO MAIN SERVER? IS IT TWO-WAY OR ONE-WAY?

Thank you!
0
 
LVL 43

Expert Comment

by:ravenpl
ID: 20368393
replication acts only one way, it's not master-master but slave master. The replicated database is read only. Server will deny write-access queries.
--read-only 

When this option is given, the server allows no updates except from users that have the SUPER privilege or (on a slave server) from updates performed by slave threads. On a slave server, this can be useful to ensure that the slave accepts updates only from its master server and not from clients. As of MySQL 5.0.16, this option does not apply to TEMPORARY tables. 

Open in new window

0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now