我有mysql 5.1.44
mysql> show engines; +------------+---------+ | Engine | Support | +------------+---------+ | ndbcluster | NO | | MRG_MYISAM | YES | | BLACKHOLE | YES | | CSV | YES | | MEMORY | YES | | FEDERATED | NO | | ARCHIVE | YES | | InnoDB | YES | | MyISAM | DEFAULT |
现在,我需要在mysql中启用联合引擎,我该怎么办?
答案 0 :(得分:55)
编辑/etc/my.cnf并在[mysqld]部分中添加以下行:
federated
它相当于在命令行中指定--federated
答案 1 :(得分:32)
我知道帖子有点陈旧,但似乎很多人都遇到了联邦引擎的问题。
当通过yum安装mysql二进制文件时,您已经拥有HA(高可用性)插件。您只需要在mysql CLI中加载插件。
以下是基本流程:
如果尚未启动mysqld,请启动它。确保此时“联合”不在/etc/my.cnf中。
EX:此时,/ etc / my.cnf将从标准的YUM安装中看起来像这样......
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
使用root(或具有足够权限的其他帐户)登录mysql CLI。
Type: show engines;
此时您应该看不到FEDERATED引擎,如下所示:
mysql> show engines;
+------------+---------+------------------------------------------------------------+--- -----------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--- -----------+------+------------+
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
5 rows in set (0.00 sec)
- > END PASTE< -
要启用联盟引擎,请键入以下内容:
install plugin federated soname 'ha_federated.so'
现在,当你'显示引擎'时,你会看到FEDERATED引擎,但是关闭......
看起来像这样:
mysql> show engines; +------------+---------+------------------------------------------------------------+--------------+------+------------+ | Engine | Support | Comment | Transactions | XA | Savepoints | +------------+---------+------------------------------------------------------------+--------------+------+------------+ | FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL | | CSV | YES | CSV storage engine | NO | NO | NO | | MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO | | InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES | | MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO | | MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO | +------------+---------+------------------------------------------------------------+--------------+------+------------+ 6 rows in set (0.00 sec)
您现在可以安全地将“联合”行添加到/etc/my.cnf文件中,如下所示:
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 federated [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
重启mysqld(服务mysqld restart等等)
重启后,返回mysql CLI。
Type 'show engines;'
您现在应该看到FEDERATED引擎可用,并且SUPPORT为YES。
mysql> show engines; +------------+---------+------------------------------------------------------------+--------------+------+------------+ | Engine | Support | Comment | Transactions | XA | Savepoints | +------------+---------+------------------------------------------------------------+--------------+------+------------+ | FEDERATED | YES | Federated MySQL storage engine | NO | NO | NO | | CSV | YES | CSV storage engine | NO | NO | NO | | MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO | | InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES | | MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO | | MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO | +------------+---------+------------------------------------------------------------+--------------+------+------------+ 6 rows in set (0.00 sec)
你完成了......出去创建联邦表......
祝你好运!答案 2 :(得分:6)
从MySQL 5.0.64开始, FEDERATED存储引擎不是 在运行中默认启用 服务器;要启用FEDERATED,你必须 使用启动MySQL服务器二进制文件
--federated
选项。 - MySQL Documentation
要在配置文件中使用--federated
option,请删除--
。
的my.cnf
[mysqld]
federated
答案 3 :(得分:0)
我正在Workbench中尝试Foward Engineer,这个错误向我显示,所以我的解决方案是Workbench->加载模型-> Mysql模型->在显示错误的表中单击,然后单击Edit。只需将Engine更改为InnoDB。
MYSQL 8