安装mysql插件rpl_semi_sync_master时报如下异常:
mysql> INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
ERROR 1126 (HY000): Can't open shared library '/usr/lib64/mysql/plugin/semisync_master.so' (errno: 2 /usr/lib64/mysql/plugin/semisync_master.so: cannot open shared object file: No such file or directory)
指定正确路径则报:
mysql> INSTALL PLUGIN rpl_semi_sync_master SONAME '/data/mysql/usr/lib64/mysql/plugin/debug/semisync_master.so';
ERROR 1124 (HY000): No paths allowed for shared library
mysql是用非root用户安装的,安装路径为: /data/mysq,需要确认basedir和plugin_dir的信息:
mysql> select @@basedir;
+-----------+
| @@basedir |
+-----------+
| /usr/ |
mysql> show variables like "plugin_dir";
+-------------------------------+--------------------------+
| Variable_name | Value |
+-------------------------------+--------------------------+
| plugin_dir | /usr/lib64/mysql/plugin/ |
+-------------------------------+--------------------------+
由上可知,默认路径不正确,需要更正,在my.cnf #添加正确的basedir和plugin_dir
[dongzw@localhost data]$ vi /data/mysql/etc/my.cnf #添加
basedir=/data/mysql
plugin_dir=/data/mysql/usr/lib64/mysql/plugin
----------------重起mysql------------
mysql> select @@basedir;
+--------------+
| @@basedir |
+--------------+
| /data/mysql/ |
+--------------+
1 row in set (0.00 sec)
mysql> show global variables like 'plugin_dir' ;
+---------------+-------------------------------------+
| Variable_name | Value |
+---------------+-------------------------------------+
| plugin_dir | /data/mysql/usr/lib64/mysql/plugin/ |
+---------------+-------------------------------------+
1 row in set (0.00 sec)
再次检查以上变量值为正确,查看已安装插件:
mysql> show plugins;
binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| mysql_native_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| sha256_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |
再次安装插件
mysql> install plugin rpl_semi_sync_master soname 'semisync_master.so';
Query OK, 0 rows affected (0.02 sec)
mysql> install plugin rpl_semi_sync_slave soname 'semisync_slave.so';
Query OK, 0 rows affected (0.00 sec)
mysql> show plugins;
| rpl_semi_sync_master | ACTIVE | REPLICATION | semisync_master.so | GPL |
| rpl_semi_sync_slave | ACTIVE | REPLICATION | semisync_slave.so | GPL |
问题解决。