1.默认federated引擎是不开启的
#mysql -u name -p
#mysql> show engines;
![](https://img.haomeiwen.com/i5637310/4aa52fca4b3338a9.png)
2.开启mysql存储federated引擎
#vi /etc/my.cnf
在文件的[mysqld]后添加一行
federated
![](https://img.haomeiwen.com/i5637310/3f9fe4c7177f45c0.png)
重启mysql
#systemctl restart mysqld.service
#mysql -uname -p
#mysql> show engines;
![](https://img.haomeiwen.com/i5637310/38768dee321af553.png)
create table `xxx` (...) ENGINE =FEDERATED DEFAULT CHARSET=utf8 CONNECTION='mysql://[name]:[password]@[host]:[端口号]/[database]/[tablesname]' COMMENT='商品表-链接表';
[xxx]代表变量,如[name]可以是root,表结构(字段名,字段类型和大小)必须一样,索引可以不用。
网友评论