Replication or symbolic links for databases

Replication or symbolic links for databases

Can you tell me how I can create linked tables in MySQL as I'm able to do in Access? I have two databases. Master tables are in one database and other tables are in another database. I want to be able to use all tables from one database with either of the two databases.

    Requires Free Membership to View

    When you register, my team of editors will also send you resources covering Linux administration and management; integration and interoperability between Linux, Windows and Unix; securing Linux and mixed-platform environments; and migrating to Linux.

    Margie Semilof, Editorial Director

    By submitting your registration information to SearchEnterpriseLinux.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchEnterpriseLinux.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

If all the databases exist on the same MySQL server, there is no need to set up anything special. You can query against tables in any database, using dbName.tableName. For example:

SELECT * FROM db1.table1 JOIN db2.table2 ON (table1.id = table2.id);

Check out "SELECT Syntax" and "Identifier Qualifiers" of the MySQL 5.0 Device Manual for more details.

If your databases are on different servers, you can either set up replication so that one server gets an update copy from the other, or you can use the FEDERATED storage engine to define a sort of symbolic link to a remote table.

Chapter 6, "Replication," and the "Federated Storage Engine" sections of the MySQL 5.0 Device Manual can help you with either of those tasks.

This was first published in September 2006