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,356 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

 
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

Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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 …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

729 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