在配置文件中启用federated:[mysqld]
federated
创建federated服务:CREATE SERVER `fed_bsp_test` FOREIGN DATA WRAPPER mysql OPTIONS ( HOST '127.0.0.1', PORT 3309, USER 'root', PASSWORD '123456@', DATABASE 'bsp_test' );
这种情况创建federated服务时,密码可以使用@特殊字符。
创建表:CREATE TABLE `t_app_raise_dust_unusual` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_time` datetime(6) DEFAULT NULL,
`create_user_id` bigint(20) DEFAULT NULL,
`deleted` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`update_time` datetime(6) DEFAULT NULL,
`update_user_id` bigint(20) DEFAULT NULL,
`group_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`group_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`sub_supervisor_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`sub_supervisor_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`supervisor_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`supervisor_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`report_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`site_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`site_id` bigint(20) DEFAULT NULL,
`site_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`audit_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`audit_time` datetime(6) DEFAULT NULL,
`audit_user_id` bigint(20) DEFAULT NULL,
`audit_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`create_site_user_role_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`create_site_user_role_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`create_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`attach` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin,
`info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin,
`reason_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`reason_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`unusual_time` datetime(6) DEFAULT NULL,
`device_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `site_id` (`site_id`),
KEY `reason_code` (`reason_code`)
) ENGINE=FEDERATED CONNECTION='fed_bsp_test/t_app_raise_dust_unusual'