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,333 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
showing numeric numbers 2 33
Which Mac app runs? 2 19
configure dependency in POM for new database 3 16
Unzip files in macOS Sierra - How? 4 22
In this article we will discuss some EI Capitan Mail app issues and provide some manual process to resolve them.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

910 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

23 Experts available now in Live!

Get 1:1 Help Now