14.6.2.1 Using InnoDB Plugin Instead of the Built-In InnoDB

To use InnoDB Plugin in MySQL 5.1, you must disable the built-in version of InnoDB that is also included and instruct the server to use InnoDB Plugin instead. To accomplish this, use the following lines in your my.cnf file:

[mysqld]
ignore-builtin-innodb
plugin-load=innodb=ha_innodb_plugin.so

For the plugin-load option, innodb is the name to associate with the plugin and ha_innodb_plugin.so is the name of the shared object library that contains the plugin code. The extension of .so applies for Unix (and similar) systems. For HP-UX on HPPA (11.11) or Windows, the extension should be .sl or .dll, respectively, rather than .so.

If the server has problems finding the plugin when it starts up, specify the pathname to the plugin directory. For example, if plugins are located in the lib/mysql/plugin directory under the MySQL installation directory and you have installed MySQL at /usr/local/mysql, use these lines in your my.cnf file:

[mysqld]
ignore-builtin-innodb
plugin-load=innodb=ha_innodb_plugin.so
plugin_dir=/usr/local/mysql/lib/mysql/plugin

The previous examples show how to activate the storage engine part of InnoDB Plugin, but the plugin also implements several InnoDB-related INFORMATION_SCHEMA tables. (For information about these tables, see InnoDB INFORMATION_SCHEMA tables.) To enable these tables, include additional name=library pairs in the value of the plugin-load option:

[mysqld]
ignore-builtin-innodb
plugin-load=innodb=ha_innodb_plugin.so
  ;innodb_trx=ha_innodb_plugin.so
  ;innodb_locks=ha_innodb_plugin.so
  ;innodb_lock_waits=ha_innodb_plugin.so
  ;innodb_cmp=ha_innodb_plugin.so
  ;innodb_cmp_reset=ha_innodb_plugin.so
  ;innodb_cmpmem=ha_innodb_plugin.so
  ;innodb_cmpmem_reset=ha_innodb_plugin.so

The plugin-load option value as shown here is formatted on multiple lines for display purposes but should be written in my.cnf using a single line without spaces in the option value. On Windows, substitute .dll for each instance of the .so extension.

After the server starts, verify that InnoDB Plugin has been loaded by using the SHOW PLUGINS statement. For example, if you have loaded the storage engine and the INFORMATION_SCHEMA tables, the output should include lines similar to these:

mysql> SHOW PLUGINS;
+---------------------+--------+--------------------+...
| Name                | Status | Type               |...
+---------------------+--------+--------------------+...
...
| InnoDB              | ACTIVE | STORAGE ENGINE     |...
| INNODB_TRX          | ACTIVE | INFORMATION SCHEMA |...
| INNODB_LOCKS        | ACTIVE | INFORMATION SCHEMA |...
| INNODB_LOCK_WAITS   | ACTIVE | INFORMATION SCHEMA |...
| INNODB_CMP          | ACTIVE | INFORMATION SCHEMA |...
| INNODB_CMP_RESET    | ACTIVE | INFORMATION SCHEMA |...
| INNODB_CMPMEM       | ACTIVE | INFORMATION SCHEMA |...
| INNODB_CMPMEM_RESET | ACTIVE | INFORMATION SCHEMA |...
+---------------------+--------+--------------------+...

An alternative to using the plugin-load option at server startup is to use the INSTALL PLUGIN statement at runtime. First start the server with the ignore-builtin-innodb option to disable the built-in version of InnoDB:

[mysqld]
ignore-builtin-innodb

Then issue an INSTALL PLUGIN statement for each plugin that you want to load:

mysql> INSTALL PLUGIN InnoDB SONAME 'ha_innodb_plugin.so';
mysql> INSTALL PLUGIN INNODB_TRX SONAME 'ha_innodb_plugin.so';
mysql> INSTALL PLUGIN INNODB_LOCKS SONAME 'ha_innodb_plugin.so';
...

INSTALL PLUGIN need be issued only once for each plugin. Installed plugins will be loaded automatically on subsequent server restarts.

If you build MySQL from a source distribution, InnoDB Plugin is one of the storage engines that is built by default. Build MySQL the way you normally do; for example, by using the instructions at Section 2.11, “Installing MySQL from Source”. After the build completes, you should find the plugin shared object file under the storage/innodb_plugin directory, and make install should install it in the plugin directory. Configure MySQL to use InnoDB Plugin as described earlier for binary distributions.

If you use gcc, InnoDB Plugin cannot be compiled with gcc 3.x; you must use gcc 4.x instead.

Note

In MySQL 5.5, the InnoDB Plugin is also included, but it becomes the built-in version of InnoDB in MySQL Server, replacing the version previously included as the built-in InnoDB engine. This means that if you use InnoDB Plugin in MySQL 5.1 using the instructions just given, you will need to remove ignore-builtin-innodb and plugin-load from your startup options after an upgrade to MySQL 5.5 or the server will fail to start.