我尝试连接到正在运行的 sphinx 实例,它连接正常:
XXX@XXX:~$ mysql -P 9306
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 52
Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
但是无法执行 SELECT。我收到“未选择数据库”错误。然后我尝试杀死 sphinxd ,杀死它后我无法连接到端口 9306,所以我假设我连接正常...... 为什么我不能从索引中选择数据?我确认了很多次,索引存在并且可以搜索。
最佳答案
我找到原因了。如果您仔细查看服务器版本,您将看到:
Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu)
所以我连接到了Mysql而不是sphinx。为什么?因为我没有指定主机,并且它使用位于“/var/run/mysqld/mysqld.sock”的 mysql 套接字。您需要正确指定主机:
XXX@XXX:~$ mysql -P 9306 -h 127.0.0.1
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 2.0.5-id64-release (r3308)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
关于sphinx - 通过mysql协议(protocol)连接Sphinx导致 "No database selected"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13031313/