为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:
【操作系统】:
【CPU】:
【问题描述】*:
比如A数据库里面的A1表修改,在B数据库里面的B1表也同步修改。
比如:mysql实现两个数据库的表级数据同步
1.创建数据库db1,创建表tb1,插入数据
//建数据库db1
CREATE DATABASE db1;
//创建表tb1
USE db1;
CREATE TABLE tb1(
id INT PRIMARY KEY NOT NULL AUTO_INCREMENT
)ENGINE=INNODB;
//插入数据
insert into tb1 select NULL;
insert into tb1 select NULL;
insert into tb1 select NULL;
2:创建数据库db2
//建数据库db2
CREATE DATABASE db2;
//重点:创建映射表remote_tb1
use db2;
create table remote_tb1(
id INT PRIMARY KEY NOT NULL AUTO_INCREMENT
)ENGINE=FEDERATED
CONNECTION='mysql://root:123456@localhost:3306/db1/tb1';
//创建表tb2
create table tb2(
id INT PRIMARY KEY NOT NULL AUTO_INCREMENT
)ENGINE=INNODB;
//插入数据
insert into tb2 select NULL;
insert into tb2 select NULL;
insert into tb2 select NULL;
3: db2数据库里的表remote_tb1数据进行增删改查,db1里表tb1的数据是否会会修改
请参考达梦数据库的【外部链接】功能:https://eco.dameng.com/document/dm/zh-cn/pm/external-link.html