mysql 添加模块 ​初始化服务器

bash ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/sprite/mysql3210/

/usr/local/mysql/bin/mysqld_safe --defaults-file=/data/sprite/3210.cnf &


/usr/local/mysql/bin/mysql --defaults-file=/data/sprite/3210.cnf


查看能否动态加载:

mysql> show global variables like "have_dynamic%";

+----------------------+-------+

| Variable_name | Value |

+----------------------+-------+

| have_dynamic_loading | YES |

+----------------------+-------+

查看plugins:

mysql> show plugins;

+-----------------------+--------+--------------------+--------------+---------+

| Name | Status | Type | Library | License |

+-----------------------+--------+--------------------+--------------+---------+

| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |

| mysql_native_password | ACTIVE | AUTHENTICATION | NULL | GPL |

| mysql_old_password | ACTIVE | AUTHENTICATION | NULL | GPL |

| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |

| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |

| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |

| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |

| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |

| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |

| INNODB_LOCKS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |

| INNODB_LOCK_WAITS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |

| INNODB_CMP | ACTIVE | INFORMATION SCHEMA | NULL | GPL |

| INNODB_CMP_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |

| INNODB_CMPMEM | ACTIVE | INFORMATION SCHEMA | NULL | GPL |

| INNODB_CMPMEM_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |

| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL | GPL |

| partition | ACTIVE | STORAGE ENGINE | NULL | GPL |

+-----------------------+--------+--------------------+--------------+---------+

17 rows in set (0.00 sec)



两种方法,重启都生效

mysql配置文件中添加:

[mysqld]

plugin_dir=/path/to/plugin/directory

plugin-load=myplugin=somepluglib.so




命令行下的添加:

添加mysql模块(ha_sphinx)

INSTALL PLUGIN ha_sphinx SONAME 'ha_sphinx.so';


mysql> show plugins;

+-----------------------+--------+--------------------+--------------+---------+

| Name | Status | Type | Library | License |

+-----------------------+--------+--------------------+--------------+---------+

| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |

| mysql_native_password | ACTIVE | AUTHENTICATION | NULL | GPL |

| mysql_old_password | ACTIVE | AUTHENTICATION | NULL | GPL |

| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |

| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |

| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |

| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |

| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |

| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |

| INNODB_LOCKS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |

| INNODB_LOCK_WAITS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |

| INNODB_CMP | ACTIVE | INFORMATION SCHEMA | NULL | GPL |

| INNODB_CMP_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |

| INNODB_CMPMEM | ACTIVE | INFORMATION SCHEMA | NULL | GPL |

| INNODB_CMPMEM_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |

| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL | GPL |

| partition | ACTIVE | STORAGE ENGINE | NULL | GPL |

| SPHINX | ACTIVE | STORAGE ENGINE | ha_sphinx.so | GPL |

+-----------------------+--------+--------------------+--------------+---------+

18 rows in set (0.00 sec)


你可能感兴趣的:(mysql,添加模块,初始化服务器)