views:

374

answers:

2

My socket file is located here:

/var/run/mysqld/mysqld.sock

When I do:

rake thinking_sphinx:start

I get:

rake aborted!
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I want to tell thinking_sphinx where my socket file is. How is this possible? This issue appeared after performing a hard reboot of my slice on Slicehost.

+1  A: 

EDITED to be (hopefully) clearer:

you can specify the mysql socket to be used in sphinx search's configuration file, sphinx.conf, via sql_sock:

sql_sock = /var/run/mysqld/mysqld.sock

(note that it depends on the sql_host setting whether this value will actually be used)

you can also use thinking_sphinx' configuration file, RAILS_ROOT/config/sphinx.yml, to set (overwrite) these values:

sql_sock: /var/run/mysqld/mysqld.sock
ax
i don't really understand your answer
Tony
clearer now?
ax
A: 

The answer from ax does not work.

You can see from commit 49f467b25075666104a46b190139dd1bdbb1452f that someone's added support in SphinxHelper to set the socket. I haven't used this method, and don't have too much time to test it for you, so you're on your own with this method.

Also, curiously, in commit http://github.com/freelancing-god/thinking-sphinx/commit/a12dbd55ed9046faf6369a3d0aa452b75a31b5b6 it looks like they added support for sockets via your database.yml, however if you look at the current edge code, this seems to have been removed?

Short answer: symlink your actual mysqld.sock to the location sphinx is looking for it.