pat / thinking-sphinx

Sphinx/Manticore plugin for ActiveRecord/Rails
http://freelancing-gods.com/thinking-sphinx
MIT License
1.63k stars 468 forks source link

Unknown mysql error #1152

Closed atomical closed 4 years ago

atomical commented 4 years ago

When I connect to mysql how do I get the version? I'm getting an unknown mysql error (ThinkingSphinx::SphinxError) but I haven't upgraded mysql.


mysql> select version();
ERROR 1064 (42000): Sphinx expr: syntax error, unexpected '(', expecting $end near '()'
ivinco-sergey commented 4 years ago

If you're using Manticore Search it's

mysql> show status like 'version';
+---------+------------------------------+
| Counter | Value                        |
+---------+------------------------------+
| version | 3.2.0 e526a01@191017 release |
+---------+------------------------------+
1 row in set (0.00 sec)

Unfortunately it's not supported in Sphinx 2/3.

atomical commented 4 years ago

We're using Sphinx 2.

Server version: 2.2.11-id64-release (95ae9a6) 

I cleared the tmp/ dir and the bin files.

pat commented 4 years ago

Hi Adam

When I connect to MySQL via the command line, it starts with the following message, which includes the version:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.16 Homebrew

Is that what you're after? (And similarly: mysql --version has the same information.) Or do you want to get the MySQL version while talking to Sphinx? I feel like that's probably not going to be possible.

atomical commented 4 years ago

The mysql version while talking to sphinx. I'm running the query in mysql via the command line and it's executing properly. This is really surprising because I've pinned mysql with brew. It doesn't appear that mysql was upgraded. I am confident I'm running on mysql server 5.6.

pat commented 4 years ago

I know that Homebrew can install multiple versions of MySQL, even while keeping an old one as the primary one - so it could still be possible that Sphinx was compiled against MySQL v8. Installed versions can be found via ls /usr/local/Cellar/mysql*.

But also: I did submit a patch to Homebrew a while ago to lock Sphinx's dependency on MySQL to 5.7… so, maybe a re-install will help, just to be sure? I'm not aware of any way to see which version of MySQL Sphinx was compiled against.

atomical commented 4 years ago

I recompiled Ruby with rvm. I think it's possible openssl libraries were upgraded and that was causing the connection error. I used the debugger to step through the error from the mysql gem but the rabbit hole was going much deeper!

I have mysql 5.7 pinned with Homebrew. I've known about the mysql 8 issue. I had a coworker experience that recently.

Pat, I tipped you with BAT. You can sign up here if you're interested: https://creators.brave.com/

pat commented 4 years ago

Thanks Adam, the tip is appreciated (I've just signed up - nothing's come through yet 🤷‍♂). And good to know reinstalling helped, albeit being quite a painful fix!