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,352 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
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.

 
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

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
In this article we will discuss some EI Capitan Mail app issues and provide some manual process to resolve them.
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 …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

734 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