My software database in MySQL in localhost and another database on server.
how to i synchronise loaclhost to server database?
i want to add function in my software when my PC connect to internet that time automatic data update in server database from localhost
Use Replication
Replication enables data from one MySQL database server (the master)
to be replicated to one or more MySQL database servers (the slaves).
Replication is asynchronous - slaves need not be connected permanently
to receive updates from the master. This means that updates can occur
over long-distance connections and even over temporary or intermittent
connections such as a dial-up service. Depending on the configuration,
you can replicate all databases, selected databases, or even selected
tables within a database.
Related
I have an application where I copy data from a table of database which is in hosting company myhosting.com.
I need to copy this data to another table of a database which is in a hosting company inmotionhosting.com
It is basically copying data from 2 tables which are in two different hosting company.
Both the database are mysql and I have full rights in both the databases.
I know that we can download entire database and upload the database in another hosting company but it does not solve my purpose.
This should be very easy in PHP. Just make multiple connections ($link1, $link2, etc.) - one to each server. SELECT data from a table in $link1 and INSERT (or UPDATE) it in $link2.
The only catch is that often a hosting company will only, by default, open MySQL port (normally 3306) for the local server. If that is the case, then if your program is running on server A then it will be able to connect to MySQL on server A without a problem but not MySQL on server B. There should be an easy way in the server control panel to open up port 3306 for remote access - if not then you will have to ask the hosting company (one of them) to do that for you.
I am developing a web application in CodeIgniter and MySQL.
I need to set up a function to update data in MySQL in my local server when there is no internet connection and later switch to live server when the connections are available, restore the locally saved data into live database as well.
(There may be clients 1) at remote location who have poor internet connectivity which I need this idea for and 2) the other who can add data directly to the live server).
Is there any mechanism to get this done?
Mysql Database Replication
Replication enables data from one MySQL database server (the master) to be replicated to one or more MySQL database servers (the slaves). Replication is asynchronous - slaves need not be connected permanently to receive updates from the master. This means that updates can occur over long-distance connections and even over temporary or intermittent connections such as a dial-up service. Depending on the configuration, you can replicate all databases, selected databases, or even selected tables within a database.
I am creating a software for my client in PHP and MySql, The software will be running in the local network, the software should also run in online that is all the data should be viewed online, i would like to know is there a way to update the mysql database from local to online whenever the internet is connected, if the internet is not connected all the data will be stored in local mysql server. they wont be adding any data in the online server and they will only view the contents. Kindly help me in this
It sounds like you are looking for a way to have a read-only, "online" (assuming WAN) MySQL server which is updated from a read-write, "offline" (LAN) MySQL Server which is updated by your users.
If that's the case, you may want to consider a Master/Slave MySQL Replication configuration:
http://www.rackspace.com/knowledge_center/article/mysql-replication-masterslave
you can run a cron job in your local server which monitor and upload data to online server when internet is available. You need to track (set a status) which data is uploaded which not for synchronization
Setup replication between your mysql databases. The local network database would be the slave and the web server would be the master.
See http://dev.mysql.com/doc/refman/5.5/en/replication-howto.html for setting up replication.
I would suggest you setup master/slave replication.
I would make the local server the master and the internet server the slave.
However, if you are using a common shared hosting service, I am not too sure if you have permission to setup such DB replication structure.
Tryhttps://www.digitalocean.com/community/articles/how-to-set-up-master-slave-replication-in-mysql. However, with the mysql versions pre 5.6 (I think) you can't delay the replication from a predefined interval. However, http://alexalexander.blogspot.com/2013/03/mysql-slave-delay-how-to.html suggests using something called a percona tool kit. I haven't used it though.
I have a local intranet application which runs off a basic WAMP server in our offices. Every morning, one of our team members manually syncs our internal mysql db with our external mysql db (where our online enrollments occur). If a change is made during the day on the intranet application, it is not reflected on the external db until the following day.
I am wondering if it is possible to (essentially) tunnel to an external mysql connection from say a wamp or xampp server from within our offices and work in 'real-time'.
Anybody had any luck or advice?
Yes
Replication enables data from one MySQL database server (the master) to be replicated to one or more MySQL database servers (the slaves). Replication is asynchronous - slaves need not to connected permanently to receive updates from the master. This means that updates can occur over long-distance connections and even over temporary or intermittent connections such as a dial-up service. Depending on the configuration, you can replicate all databases, selected databases, or even selected tables within a database.
If you use the external server directly, performance is likely to suffer. A Gigabit LAN might be a thousand times faster than your Internet connection - particularly the upload speed of an ADSL connection.
Just make your internal application use the database from the external one. You may need to add permission to the external server to allow connections from your internal server IP, but otherwise this is just like having a webserver and sperate db server that need to access each other.
Can't really tell you how to do this here - it all depends on your specific configuration, something that I would thing is a little complicated (and too specialized) to figure out on SO.
How it is possible to update localhost MySql database with server mysql database at particular interval. Web application is made in PHP and database should be in MySql.
Suppose I have a Database at Hosting site Now i want to update my database at regular interval with Local Host Database at my Local Computer.Please suggest me ??
Sounds like you need to use MySQL's replication feature. Here's a walkthrough and here's the manual for reference.
It's worth noting that replication over the internet (rather than a local network) can be slow and you can end up with a slave that's minutes, even hours behind a busy master. Another option could be to periodically mysqldump the master database and copy it back to your local machine, although if your master is very busy you'll lock databases and hang queries, and if it's very large this process will take a long time.