Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
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
Medium Priority
?
1,374 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 1500 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

721 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