Connect to SphinxQL through Linux command-line

假装没事ソ 提交于 2019-12-18 10:22:37

问题


I am trying to connect to SphinxQL server through Linux command-line this way:

> mysql -P 9306

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

My Sphinx config file has 2 listen entries:

listen                  = 9312
listen                  = 9306:mysql41

searchd daemon is running:

> ps ax | grep searchd
10727 ?        S      0:00 /usr/local/sphinx/bin/searchd
10728 ?        Sl     0:00 /usr/local/sphinx/bin/searchd

Regular search queries work perfectly:

> /usr/local/sphinx/bin/search StackOverflow | more

Sphinx 2.0.4-release (r3135)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/usr/local/sphinx/etc/sphinx.conf'...
index 'test1': query 'StackOverflow ': returned 2 matches of 2 total in 0.009 sec

displaying matches:
1. document=1788212, weight=1797
        id=1788212
...

So, what I am doing wrong? How can I get access to SphinxQL console?

Any hint will be appreciated. Thanks in advance!


回答1:


the 'mysql' client, will totally ignore the -P param, if it detects mysql is running on a unix-socket. So really even though you ask for the sphinxQL port, you are connecting to mysql

Use

mysql -P9306 --protocol=tcp

to tell the client to ignore the socket.

Pro Tip:

mysql -P9306 --protocol=tcp --prompt='sphinxQL> '

which serves as a useful ongoing reminder you are connected to sphinx not mysql :)




回答2:


Works for me:

mysql -P 9306 -h 0



回答3:


I ran into this recently. I was able to get in to Sphinx via the mysql shell by commenting out the listen configuration that didn't specify MySQL. This may not work for you, if you still need to get to searchd via the API.



来源:https://stackoverflow.com/questions/12126948/connect-to-sphinxql-through-linux-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!