A FEDERATED storage engine lets you to view data from a remote MySQL database instance without having cluster or data replication setup on MySQL server.

The FEDERATED storage engine is available beginning with MySQL 5.0.3. To enable Federated storage engine on your MySQL server configure with “–with-federated-storage-engine” option.

Lets assume you have two different MySQL database and you need to write and update tables on both MySQL database servers (Local & Remote).

Follow the instructions to enable FEDERATED Storage engine.
Login to you Local MySQL server and edit my.cnf file
[bala@local ~]# vim /etc/my.cnf
[mysqld]
federated

Once your are done with changes restart your MySQL server on Local Server
 [bala@local ~]#/etc/init.d/mysqld restart

Now lets create table on Local Server  
[bala@local ~]# mysql -u root -p****** 
CREATE TABLE test1 (
       a INT,
       b VARCHAR(32))

Create similar TABLE on your Remote Server as you created perviosly on your Local Server.[bala@remote ~]# mysql -u root -p****** 
CREATE TABLE test1 (
       a INT,
       b VARCHAR(32))
ENGINE=FEDERATED CONNECTION='mysql://username:password@local:3306/userdatabase
/test1';

Insert data in Remote Server
INSERT into test1(a,b) VALUES(1,'Bala');

Check the Remote Server the data which you just created should be available on both Servers.

Feedbacks: We appreciate your feedbacks and suggestions about our website bala@techgyaan.org
Check out . Follow @techgyaan