How to merge local and remote databases? - mysql

I am working with a live site that is dependent on a database (which I have access to). I have copied the site locally and am running it with MAMP. All of the files from the server are version-controlled using git, so the files on my localhost are always up to date with the ones on the server.
However, the database doesn't work as well as the files. To merge the changes from the live database I have to export it as a .sql file, then import it into my localhost. However, if the local database changes, those aren't reflected when I re-import. How can I merge the changes so that I keep my local database updates, but "pull" the remote changes so it is up to date?

Well, you have multiple options here.
You can use FEDERATED Storage Engine and can query the remote database locally. FEDERATED Storage Engine is kind of same as Linked Server in MS SQL Server
You can as well set up Replication between the servers (Transactional Replication). In which case, depending on the setup data from primary will get synced with the secondary server; if not instantly but over a period of time.
You can as well User MySQL BackUp and Restore procedure. I mean specifically, Differential/Incremental Backup

Related

How to sync and merge local MySQL db with server MySQL db?

I have an app with a MySQL db running on a local network and I need to host it online. I need to work on the local version of the app on the local network and the server version outside the network.
I need the data to be consistent where the db is the same locally and on the server. Assume the same fields will not change on both (no merge conflict) and that sync and merge can take place once everyday - at the end of the day. Data may change on the local version, server version or both, that's why I need a merge. I've seen many other posts but couldn't find a clear solution.
How is that possible?

2 way sync of MySQL databases

A web application runs both on live and local server with live and local database server. Users use live server to add the data, whereas internal staffs use the local application to update the data. After some time, both of these databases have to be synchronized properly without loss of data from live or local database server. I don't want an exact replica of live database in local database or vice-versa but databases need to synchronize values which have been entered in it.

Replicate my local database (Mysql) to remote database( phpmyadmin)

My MySQL database (local server) is connected to a weather station. The data are updated continuously on my local server. My idea is to develop a web application that allows me to access this data.
My local database (MySQL) has to be replicated on a remote server (phpmyadmin)
The architecture is as follows:
My questions are:
1- How I do the connection ? I know that I can import my cvs file manually but I don't want to do this.
2- Can I update the datas automatically in my remote server ?
NOTE: I only want to queries on my remote server (phpmyadmin), I will not create or modify new datas.
Thanks you for your help.
As i understood, you want to make a copy of your local mysql data on a remote server.
first of all phpmyadmin is a tool or webapp to access mysql , it is not a server itself.
and second
there are two type of replication approach
Master-slave (read from slave , write to master, that will sync to slave)
How to do it
Master- Master (whatever operation are on master that will also replicate on other master) How to do it (Master-Master replication is deprecated. See Group Replication as a replacement)
You can choose the approach as per your requirement
Master-master vs master-slave database architecture?
How to achieve replication
http://dev.mysql.com/doc/refman/5.7/en/replication-howto.html

how to synchronize two databases of different servers?

I have two databases. One is on local server and the other is on a production server. I'm continuously working on the local server and after approval I want to update production server. Wih the current setup, I need to take dump or copy or export of database and then import into production database, every time. Is there any way of synchronization method in phpmyadmin for database on different server.
It is possible to synchronize a model in MySQL Workbench with a live database?
Other then this, how can I do this? I'm able to use queries, the command line and phpmyadmin itself.
Please specified any simple method.
The "synchronisation" feature you are looking for is called replication. A replication can be set up between a master and a slave machine. It does not rely on a constant connection, but stores all changes on the master and replays all those changes on the slave once a connection is established.

Back up MySQL using phpMyAdmin

I have used MySQL for my application written by PHP. After a time its data will be great and I need to make a backup from them. Also, I need I can restore the backup data whenever I need. My question is if phpMyAdmin can make backup and resotore it secure and completely without any data lose?
(I have both MyISAM and innoDB in my database structore)
Also, if you know any other IDE to make backup and restore it without showing the database structures and tables to the end-user, please tell me their names.
Thank you.
If you're running MySQL on your own server you may copy the database folder, but the MySQL server would have to be stopped first. Anyway I'd recommend dumping the databases through phpMyAdmin (export function) or via the command line (mysqldump). Using the latter, you may write a batch script that also compresses and encrypts the content of the dump file.
Using the built in Import and Export? The only data loss would be everything after the backup until the time the backup was imported.
Securely? That's an entirely different topic. There's too many things to consider to call anything secure but if you're using https or on a trusted LAN, then yes, I guess it's secure.
I think MySQL Workbench can do exports and imports.
If would you wish to backup MySQL database more securely and periodically without loss of data to remote server or local drive (local hard disk or mapped drive), then you can try Vembu StoreGrid http://www.vembu.com/, a leading backup software trusted by more than 2700 service providers world wide. Once you configured single backup by selecting entire database then automatically newly added database will be backedup on upon next backup time. Also, StoreGrid backups only the incremental bytes of changes on next incremental schedule.
Vembu has a solution for almost everyone, just check them below:
For Service Providers : StoreGrid Service Provider Edition
For Business/Offices : StoreGrid Professional Edition
For Home Users: Vembu Home
For Resellers who don't want to have their own storage : Vembu Pro
For Hosting Providers: StoreGrid Hosting Provider Edition (yet to be released)
For your requirement, we would suggest the Professional Edition http://storegrid.vembu.com/online-backup/network-backup.php of StoreGrid. Try it!!!
Regards,
Thileepan
vembu.com