MySQL 通过 Linux 命令行连接到 SphinxQL

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12126948/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 14:38:28  来源:igfitidea点击:

Connect to SphinxQL through Linux command-line

mysqlcommand-linesearch-enginesphinx

提问by snippetsofcode

I am trying to connect to SphinxQLserver through Linux command-linethis way:

我正在尝试通过这种方式通过 Linux命令行连接到SphinxQL服务器:

> mysql -P 9306

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

My Sphinx config file has 2 listen entries:

我的 Sphinx 配置文件有 2 个监听条目:

listen                  = 9312
listen                  = 9306:mysql41

searchd daemon is running:

searchd 守护进程正在运行:

> 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?

那么,我做错了什么?如何访问 SphinxQL 控制台?

Any hint will be appreciated. Thanks in advance!

任何提示将不胜感激。提前致谢!

回答by barryhunter

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

'mysql' 客户端将完全忽略 -P 参数,如果它检测到 mysql 正在 unix-socket 上运行。因此,即使您要求使用 sphinxQL 端口,您也确实连接到了 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 :)

这是一个有用的持续提醒您连接到 sphinx 而不是 mysql :)

回答by mafin

Works for me:

对我有用:

mysql -P 9306 -h 0

回答by Chris Henry

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

我最近遇到了这个。通过注释掉listen未指定 MySQL的配置,我能够通过 mysql shell 进入 Sphinx 。如果您仍然需要searchd通过 API访问,这可能对您不起作用。