After installing MySQL, how to activate the federation engine?
P粉475126941
P粉475126941 2023-10-18 08:51:44
0
2
517

I have 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 |

I need to enable federation engine in mysql. what should I do?

P粉475126941
P粉475126941

reply all (2)
P粉296080076

I know this post is a bit old, but it seems like a lot of people are having issues with the union engine.

When installing the mysql binary via yum, you already have the HA (High Availability) plugin. You just load the plugin in the mysql CLI.

The basic process is as follows:

Start mysqld (if not already started). Make sure "federated" is not in /etc/my.cnf at this time.

EX: At this point, /etc/my.cnf will look like this on a standard YUM installation...

[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

Log in to the mysql CLI using root (or another account with sufficient permissions).

Type: show engines;

You should not see the FEDERATED engine at this point, as shown below:

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 pasting

To enable the federation engine, type the following:

install plugin federated soname 'ha_federated.so'

Now when you "Show Engines" you will see the FEDERATED engine, but it is turned off...

It looks like this:

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)

You can now safely add the "federated" line to the /etc/my.cnf file like this:

[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

Restart mysqld (service mysqld restarts, etc...)

After restarting, return to mysql CLI.

Type 'show engines;'

You should now see that the FEDERATED engine is available and SUPPORT is 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)

You are done...continue to create federated tables...

Good luck!

    P粉457445858

    Edit/etc/my.cnfand add the following lines in the[mysqld]section:

    federated

    Equivalent to specifying--federated

    on the command line
      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!