sphinx - 通过mysql协议(protocol)连接Sphinx导致 "No database selected"错误

标签 sphinx mysql

我尝试连接到正在运行的 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/

相关文章:

sphinx - 如何将 Sphinx 实时索引移动到另一台服务器?

search - 如何索引纯文本文件以在 Sphinx 中进行搜索

php - 如何在不占用资源的情况下提供实时通知?

php - 属性集合中的 Sphinx 搜索

php - 使用 MariaDB 的 SphinxSE 基本语法问题

mysql - 从 MySQL 中检索文本数据的 SQL 语句,其中字段中的每个单词都重复

mysql - 历史/审计表的设计建议

mysql - ThinkingSphinx::SphinxError 失去与 MySQL 服务器的连接 ( 'reading initial communication packet')

Javascript(NodeJs) - 将数组和对象转换为批量插入 mysql(Sequelize)

mysql 查询在 groupby 中包含零计数