如何解决sphinx启动报错:sql_connect: failed to load libmysqlclient (or libmariadb)

发布时间:2021-07-05 18:21:12 作者:chen
来源:亿速云 阅读:370

本篇内容主要讲解“如何解决sphinx启动报错:sql_connect: failed to load libmysqlclient (or libmariadb)”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“如何解决sphinx启动报错:sql_connect: failed to load libmysqlclient (or libmariadb)”吧!

问题

在centos 7 下载shpinx 3 后,启动./bin/indexer 或 ./bin/searchd 报错:

ERROR: index 'attr_node': sql_connect: failed to load libmysqlclient (or libmariadb) (DSN=mysql://apps:***@localhost:3306/phalapi).

解决方案

1、尝试添加软链接

# find / -name 'libmysqlclient*'

/usr/lib64/mysql/libmysqlclient.so.18
/usr/lib64/mysql/libmysqlclient.so.18.0.0

# ll /usr/lib64/mysql/libmysqlclient.so.18*

# ln -s /usr/lib64/mysql/libmysqlclient.so.18.0.0 /usr/lib/libmysqlclient.so

但是发现不行。

2、尝试添加环境变量

# vim /etc/ld.so.conf

export LD_LIBRARY_PATH=/usr/lib64/mysql:$LD_LIBRARY_PATH

source后再次执行启动脚本 也不行。

3、修改/etc/ld.so.conf,可以了!

执行:

[root@localhost sphinx-3.1.1]# echo "/usr/lib64/mysql" >> /etc/ld.so.conf && ldconfig

结果,成功了!索引构建与启动都成功了!

[root@localhost sphinx-3.1.1]# ./bin/indexer --all                                   
Sphinx 3.1.1 (commit 612d99f)
Copyright (c) 2001-2018, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file './sphinx.conf'...
WARNING: key 'docinfo' was permanently removed from Sphinx configuration. Refer to documentation for details.
WARNING: key 'dict' was permanently removed from Sphinx configuration. Refer to documentation for details.
WARNING: key 'mva_updates_pool' was permanently removed from Sphinx configuration. Refer to documentation for details.
indexing index 'attr_node'...
collected 10 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 10 docs, 3.7 Kb
total 0.0 sec, 149.3 Kb/sec, 400 docs/sec

[root@localhost sphinx-3.1.1]# ./bin/searchd                
Sphinx 3.1.1 (commit 612d99f)
Copyright (c) 2001-2018, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file './sphinx.conf'...
WARNING: key 'docinfo' was permanently removed from Sphinx configuration. Refer to documentation for details.
WARNING: key 'dict' was permanently removed from Sphinx configuration. Refer to documentation for details.
WARNING: key 'mva_updates_pool' was permanently removed from Sphinx configuration. Refer to documentation for details.
listening on all interfaces, port=9312
listening on all interfaces, port=9306
precaching index 'attr_node'
precached 1 indexes in 0.007 sec

到此,相信大家对“如何解决sphinx启动报错:sql_connect: failed to load libmysqlclient (or libmariadb)”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

推荐阅读:
  1. 用 Sphinx 搭建博客时,如何自定义插件?
  2. Sphinx源码分析——Indexer

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

sphinx

上一篇:http推流原理是什么

下一篇:Python中怎么去除背景

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》