Example of Mysql Federated Server

Source: Internet
Author: User

The Federated storage engine accesses data in a table in a remote database, rather than a local table. When creating a Federated table, the server creates a table definition file in the database directory. No other table is created because the actual data is stored in a remote database. This is different from the storage engine used for the local surface.

1. Check whether the current server configuration supports the Federated storage engine:

Show Engines;

Query results. If the Federated row's Support column value is YES, the current server supports the Federated storage engine.

If the value of the Support column corresponding to the Federated row is NO, we need to configure it. Find the my. ini file in the installation directory of the server, open the file in notepad, add Federated, save, and restart the server.

2. on the remote server, create a local table and import data.

    ()  ()  ()  ` ()  InnoDB  CHARSET  `departmentweekdata` (`department`, `week`, `interval`, ``) , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , );

3. Create a Federated table on the local server.

 ()  ()  () `  ;

The CONNECTION string example: CONNECTION = 'mysql: // root: 123@127.0.0.1: 3306/dbTest/testtable ';

4. If you use the MySQL client tool, you can create the Federated Server:

  

5. If you have created a Federated Server, you can use the following method to create a Federated table:

 ()  ()  () `  ;

6. After creating the Federated table, you can access the data in the remote database table.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.