MySQL Federated table

Federated table in MySQL is just like a link table in Microsoft SQL Server. It imports the table structure and data from any other server or database, and also synchronize the data as well.

To Enable the federated storage,note the following step :
1. Stop your currently running MySQL service
2. From Command Prompt, run the mysqld.exe with the parameter –federated (mysqld.exe –federated).
3. You can close the command-window above.
4. Start your service again, you now have federated storage engine enabled, check with SHOW ENGINES \G.
5. Go to C:\Program Files\MySQL\MySQL Server 5.0
6. Open the file my.ini. Just put federated after [mysqld] and save the file.
7. Restart MySQL server and type command SHOW ENGINES \G .
8. You will see a value  'YES' in Support column for engine FEDERATED.

Below is the example how to create a federated table :
Let say, we have a "my_aspnet_Users" table at server 192.168.30.19 with database name "test".
So, now we want to create the link table that linked to table above.
We can type and execute the following sql script :

Done ... and check on your database, it has a new federated table.

Okay,
Hope this helps

No comments:

Post a Comment