溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

如何解決sphinx啟動(dòng)報(bào)錯(cuò):sql_connect: failed to load libmysqlclient (or libmariadb)

發(fā)布時(shí)間:2021-07-05 18:21:12 來(lái)源:億速云 閱讀:359 作者:chen 欄目:大數(shù)據(jù)

本篇內(nèi)容主要講解“如何解決sphinx啟動(dòng)報(bào)錯(cuò):sql_connect: failed to load libmysqlclient (or libmariadb)”,感興趣的朋友不妨來(lái)看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來(lái)帶大家學(xué)習(xí)“如何解決sphinx啟動(dòng)報(bào)錯(cuò):sql_connect: failed to load libmysqlclient (or libmariadb)”吧!

問(wèn)題

在centos 7 下載shpinx 3 后,啟動(dòng)./bin/indexer 或 ./bin/searchd 報(bào)錯(cuò):

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

但是發(fā)現(xiàn)不行。

2、嘗試添加環(huán)境變量

# vim /etc/ld.so.conf

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

source后再次執(zhí)行啟動(dòng)腳本 也不行。

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

執(zhí)行:

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

結(jié)果,成功了!索引構(gòu)建與啟動(dòng)都成功了!

[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

到此,相信大家對(duì)“如何解決sphinx啟動(dòng)報(bào)錯(cuò):sql_connect: failed to load libmysqlclient (or libmariadb)”有了更深的了解,不妨來(lái)實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI