问题
I try to run gem 'thinking-sphinx' on my Ruby on Rails project, but something was wrong. When I run any search command on any model, I see this error: ThinkingSphinx::SphinxError (Unknown MySQL error).
More details:
- MacOS Mojave -v 10.14.3
- mysql -v 8.0.15 (Installed first)
- Sphinx -v 2.2.11_2 (Installed via 'brew install sphinx')
- thinking-sphinx -v 4.2.0
- Rails -v 5.2.2
Before run search command, I runned rails ts:index and rails ts:start
What am I doing wrong?
回答1:
Sphinx v2.2 (and 3.0) is not compatible with MySQL v8. You'll either want to downgrade MySQL to 5.7 - which can be done with homebrew via brew install mysql@5.7
- and then uninstall and reinstall Sphinx, or download the binaries for Sphinx v3.1.1 (the first version to support MySQL v8) from the Sphinx website (the source code for that release is not currently available, hence it's not installable via homebrew).
回答2:
Just changed mysql2 from gem "mysql2", '~> 0.4.6'
to gem "mysql2", '0.4.10'
version, and it worked for me. Thanks
来源:https://stackoverflow.com/questions/55187763/thinkingsphinxsphinxerror-unknown-mysql-error