Synchronize 2 database one in web hosting and other in localhost - php

I have a mysql database in web hosting domain,and the same database is created in my localhost domain.
So I want to copy(or synchronize) the database with all tables and data from the hosting to localhost,and I want this Procedure working every day automatically.
Any help please?
Copy or synchronize the database in hosting with the same database in localhost every day automatically.

Related

Cloud syncing to central database from local servers laravel 4.2

For my project, there are webapps installed on local servers. Whenever there is internet connection available, a press of a sync button on local server app should sync the database and the user uploaded files with central server. The central server should know from where the data is coming. I am building the local server apps using laravel 4.2. Is there a simple way I can achieve this?
I solved it using an extra column synced in all the tables on both local and cloud server and wrote code to send data through JSON APIs. Then, I updated the synced column with timestamp on both ends. And then on every sync button press, I compared updated and synced column and sent the data to the server accordingly.
I don't know if this is the perfect solution but worked for me.

How to Synchronize mysql database to update from localhost to online server

I'm trying to make an Application that Runs in Localhost.
In the end of the day, I need to update my online database by data from my local database and I have NO idea how to do that.
can anyone tell me how to do that...?
I'm using codeigniter to make this app.
First, You should know How to Connect to the MySQL Database Remotely and How to allow remote connection to mysql than you can use syncr to synchronize your mysql databases

Can I host a websites MySQL Database on my laptop

I have finally finished bootstrap website (thanks to some help from the kind folk in this community) and was wondering if I can host the websites MySQL DB on my personal laptop while the site is hosted through a hosting service?
I have configured a PHP script to send the form data by email but I also want to send it to a MySQL DB which I can administer from my home rather than through the host provider.
Yes, you can host MySQL DB on your own personal laptop. You can check out XAMPP, for example, which comes as out-of-the-box bundle including not only MySQL but other features as well - PHP, phpmyadmin and so forth: https://www.apachefriends.org/index.html

CodeIgniter: How to synchronize local and remote databases

I have a Hotel monitoring web application developed in CodeIgniter.
It monitors each room of a hotel for activities and Sends live data about rooms occupancy, status of electrical switches etc.
It hosted in cpanel web server. I have the same copy of it in my local computer.
I want to synchronize the 2 databases (ie. in localhost and in remote server).
Every change in any database should be automaticaly updated to other database.
First I tried to access my remote database from localhost by putting host name as my cpanel Shared IP Address as follos
$db['default']['hostname'] = 'xx.xx.xx.xx';
where xx.xx.xx.xx is the shared IP of cpanel. but no use.
how should I proceed?
Thanks in advance
Option 1: The Codeigniter Way
You can set up a remote access MySQL server:
Tutorial for cpanel here: https://www.liquidweb.com/kb/enable-remote-mysql-
connections-in-cpanel/
Then just set up a new connection in your database.php changing the to $db['remote']['hostname'] = 'xxx.xxx.xxx.xxx';
Do note that you'll have to make a method to pull in this new data and replace it in your local database, so a script that can be run via cronjob.
Option 2: The Master/Slave Way
You can set up a Master database, being the hotel, and a slave being your local database. I don't know of a method to do this straight cpanel, but you can do it in phpmyadmin, there's a video on how to do it here: https://www.youtube.com/watch?v=nfsmnx24gxU
This method would be the most comprehensive/automatic way to do it. It will overwrite any changes in your database though.
Note that any outside access to a database is potentially insecure. Be aware of this when choosing.

How to sync local database and server with PHP&MYSQL webapp

I have a web application in PHP & MySQL.
It has three local systems connected with one database server.
Each local system has a primary computer which has the source code connected directly to database server. Other computers connect to each primary computer to use the application.
The problem is:
When the connection drops between one of these systems and the database server, the application can store data in the local system database. When the connection comes back up again, I want the local database changes to the synchronized with the remote database.
How can I do this?

Categories