2

我尝试连接到一个正在运行的 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,所以我假设我连接正常......为什么我不能从索引中选择数据?我多次确认,索引存在并且可以搜索。

4

1 回答 1

4

我找到了原因。如果您仔细查看服务器版本,您将看到:

 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> 
于 2012-10-23T13:21:59.260 回答