处理mysql报错: Can't open shared library 和 No paths allowed for shared library

安装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     |

问题解决。
 

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值