Saving all local MySQL operations to replicate them to an online database - mysql

I have two databases right now: one in local and one in the cloud.
I was wondering if it would be possible to save all the MySQL DML commands/operations that I perform in my local database somewhere (e.g. local file system, or even a new separate table for it in the database) so I can then process all of those commands, one by one and replicate them to my database in the cloud?
The reason is that I'm using my database in the cloud as the backup database and so my local database and my online database should be in sync.
If what I'm thinking isn't possible, is there another way around this?
Thank you very much!

Replication or Use canal may solve your problem

Yes, there is such a feature. It's called the Binary Log. There's no need to explain further, because it has full documentation. Visit the link I just provided.
It's probably not easy to use replication in your case, because it would require your remote MySQL Server to connect to your local MySQL as a client, and I expect that's not possible because of firewalls or NAT.
But you could collect your local binary logs, and upload them periodically, and then use the same technique as point-in-time recovery to apply them to the remote MySQL server. See https://dev.mysql.com/doc/refman/8.0/en/point-in-time-recovery-binlog.html

Related

How to replicate data from my local phpmyadmin mysql database to godaddy cpanel mysql database?

I am having a MySQL database in my local machine (in XAMPP) that I access using phpmyadmin. I also have a website hosted on Godaddy. I generally stay offline and make changes into data stored into database.
I want to know how can I auto replicate the changes in local database to the one in Godaddy's server or can replicate using click of a button.
I have seen some answers that told about replication but I am unable to replicate data from my local machine to the Godaddy's server.
Can anyone please tell me the steps to replicate database in simplest way.
Thank you in advance!
After lot of searching and learning, I finally found an answer to this question.
On shared hosting, Godaddy do not provide access to the configuration files of mysql (my.ini). So the replication of data is not possible using master slave replication from local(master) to remote(slave) MySQL.
The only thing that can be done is, one can create a log file of all the data that are being entered into database while the user is offline (maybe a XML file) which contains the data that is not transfered to the global database, and can upload the file when connected to the internet and parse the XML to send data to the global database.

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.

multiple machine MySQL through Workbench

I have recently started using MySQL Workbench, hence I apologise if this is not the proper platform to ask this question. I tried to figure out the solution of my own, but could not find any appropriate one.
Here is my situation: At my workplace, we have a huge set of data about the operational and financial figures such as sales, employee, profit, etc for European companies spread over past 7-8 years and new data keeps coming regularly. However, the problem is we work from different remote locations, me in one city and the other two colleagues in a different city. Normally, we share our work files (.xls/.doc) etc through Dropbox. So, we thought of creating a database in MySQL wherein we all can submit/edit/add this data so that we can filter and analyse this data on several ways once the collection is complete. And we plan to use and access it thereafter. We believe that this is ease a lot of our work. So all I want to know is: can all three of us collaborate simultaeousy (in order to add or edit the data) through workbench Server administration, like the way we collaborate our work through Dropbox? I want to be the host (like the administrator) and then want to allow the access to my colleagues.
Thank you for your time and answer. You may also refer me to any site or link to read more about it.
I think you are a bit confused about what MySQL Workbench is.
MySQL workbench is just a data viewer and administration tool that connects to a MySQL server, there's no data "stored" in MySQL workbench, all the data is stored in the server.
MySQL workbench can:
Connect to a MySQL server
Send SQL instructions and show the results: You can create and drop databases, send SQL queries, create and execute stored procedures and functions... all assuming you have the right privileges.
Perform administration tasks: You can create and drop users, grant or revoke permissions, etcétera
But the fact is: all is stored in a MySQL server... so the answer to your question is: Yes, you can work simmultaneously with your colleagues, if and only if all of you can connect to the same database server (as Mike W commented).
Addressing your comments, and clarifying more details:
MySQL is a database server. When you install it in a computer, all data is stored in that computer (aside from replication and other fine details). You should make regular backups of your data (MySQL has tools for that, one is mysqldump). If you want to access the data stored in your database server, you can do it:
By ussing the command-line client,
By using MySQL workbench or another GUI client program, or
By any program that can connect to the database server (via ODBC or specific libraries).
Focusing on MySQL Workbench, and addressing your specific question: If your machine breaks down, you can install the MySQL Server in any other machine, and load the backup into it. You will have to configure that new machine so that any of your coworkers can connect to it (that may imply that a new set of connection parameters is created).

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

How to backup mysql database while application is running?

What is the prefer way to generate mysql backup while application is running ?
I want to provide functionality to admin to take backup of database at the same time when other admin using the same application from other computer.
What is the prefer way to handling this scenario ?
Hopefully you can take backup using mysqldump utility without stopping the database. Mysqlworkbench application provides easier interface to do this. If you are looking for a more advanced option and worry about transaction you can set up a replicated server, so that you can take the stable backups without stopping the master server.
if you are working on a webserver with php support use phpMyAdmin or any mySQL Dumper