1. 用mysql> show plugins;  命令查看MySQL已经安装的插件

+--------------+----------+--------------------+---------------------+---------+
| Name         | Status   | Type               | Library             | License |
+--------------+----------+--------------------+---------------------+---------+
| binlog       | ACTIVE   | STORAGE ENGINE     | NULL                | GPL     |
| partition    | ACTIVE   | STORAGE ENGINE     | NULL                | GPL     |
| ARCHIVE      | ACTIVE   | STORAGE ENGINE     | NULL                | GPL     |
| BLACKHOLE    | ACTIVE   | STORAGE ENGINE     | NULL                | GPL     |
| CSV          | ACTIVE   | STORAGE ENGINE     | NULL                | GPL     |
| FEDERATED    | DISABLED | STORAGE ENGINE     | NULL                | GPL     |
| MEMORY       | ACTIVE   | STORAGE ENGINE     | NULL                | GPL     |
| InnoDB       | ACTIVE   | STORAGE ENGINE     | NULL                | GPL     |
| MyISAM       | ACTIVE   | STORAGE ENGINE     | NULL                | GPL     |
| MRG_MYISAM   | ACTIVE   | STORAGE ENGINE     | NULL                | GPL     |
| INNODB_TRX   | ACTIVE   | INFORMATION SCHEMA | ha_innodb_plugin.so | GPL     |
| INNODB_LOCKS | ACTIVE   | INFORMATION SCHEMA | ha_innodb_plugin.so | GPL     |
+--------------+----------+--------------------+---------------------+---------+
12 rows in set (0.00 sec)

安装方法1. 在configure的时候加上--with-plugins=innobase 如果要添多个插件,请用半角逗号隔开

配置文件, 将my.cnf配置文件中[mysqld]下面有关innodb配置前面的#去掉就可以了。这是默认配置,可以根据个人需要进行修改

 

安装方法2

先查看是否支持动态加载, 重要的是have_dynamic_loading这行,如果是YES,那么继续

mysql>show variables like "have_%"

+-------------------------+----------+
| Variable_name           | Value    |
+-------------------------+----------+
| have_community_features | YES      |
| have_compress           | YES      |
| have_crypt              | YES      |
| have_csv                | YES      |
| have_dynamic_loading    | YES      |
| have_geometry           | YES      |
| have_innodb             | YES      |
| have_ndbcluster         | NO       |
| have_openssl            | DISABLED |
| have_partitioning       | YES      |
| have_query_cache        | YES      |
| have_rtree_keys         | YES      |
| have_ssl                | DISABLED |
| have_symlink            | YES      |
+-------------------------+----------+
14 rows in set (0.00 sec)

安装插件

mysql> INSTALL PLUGIN INNODB SONAME 'ha_innodb.so';
mysql> install plugin INNODB soname "ha_innodb.so";  
mysql> install plugin INNODB_TRX soname "ha_innodb.so";  
mysql> install plugin INNODB_LOCKS soname "ha_innodb.so";  
mysql> install plugin INNODB_LOCK_WAITS soname "ha_innodb.so";  
mysql> install plugin INNODB_CMP soname "ha_innodb.so";  
mysql> install plugin INNODB_CMP_RESET soname "ha_innodb.so";  
mysql> install plugin INNODB_CMPMEM soname "ha_innodb.so";  
mysql> install plugin INNODB_CMPMEM_RESET soname "ha_innodb.so" 

 

我的debian系统上ha_innodb.so文件在/usr/lib/mysql/plugin目录下

p466106@devhz503:/usr/lib/mysql/plugin$ ls -l
total 1252
lrwxrwxrwx 1 root root      25 Jul 15 06:09 ha_innodb_plugin.so -> ha_innodb_plugin.so.0.0.0
lrwxrwxrwx 1 root root      25 Jul 15 06:09 ha_innodb_plugin.so.0 -> ha_innodb_plugin.so.0.0.0
-rw-r--r-- 1 root root 1276696 Nov 30  2010 ha_innodb_plugin.so.0.0.0

 

如何使用这些【information_schema】中的INNODB_TRX,INNODB_LOCKS, INNODB_LOCK_WAITS表?

???