MySQL Open federated Engine implements database table mapping

Source: Internet
Author: User
Tags server port

1. Check to see if the federated engine is turned on

Click to enter Navicat and click on the keyboard F6, the command line interface, input instructions: show engines;

2. Turn on the Federated engine

Windows systems: adding federated to My.ini

3. Create a mapping table

There is a MySQL database test_a on Server A and a MySQL database test_b on server B. Now you need to map the user table data in the TEST_A library to the database Test_b. The table user needs to be established in the database Test_b, with the engine and CONNECTION in mind .

CREATE TABLE User(IDint( One) not NULL, namevarchar( -) not NULL, Ageint( One) not NULL,  PRIMARY KEY(ID)) ENGINE=Federated CONNECTION='Mysql://test:[email Protected]:3306/test_a/user'DEFAULTCHARSET=UTF8;

In the link above, test is the user name of the linked database; 123456 is the password; 192.168.1.5 is the database server ip;3306 is the database server port; test_a is the database name; user is the database table name.

Here are some examples of connection strings:

CONNECTION = ' Mysql://username:[email protected]:p ort/database/tablename ' CONNECTION = ' Mysql://[email Protected]/database/tablename ' CONNECTION = ' Mysql://username:[email Protected]/database/tablename '

4. The MySQL database test_a settings on Server A can be accessed remotely, and the test user is assigned Read and write access to the related table.

5. At this point, after modifying the user table in the Test_b, you can see the changes in the user table in the test_a, in the same vein, after modifying the user table in Test_a, you can test_ You see the changes in the user table in B.

MySQL Open federated Engine implements database table mapping

Related Article

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.