etianen / django-watson

Full-text multi-table search application for Django. Easy to install and use, with good performance.
BSD 3-Clause "New" or "Revised" License
1.2k stars 130 forks source link

Watson appears to break when using MySQL 5.7 #255

Closed moggers87 closed 4 years ago

moggers87 commented 5 years ago

While working on #254 I found that MySQL tests error with the following:

django.db.utils.OperationalError: (1055, "Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test_test_project.watson_searchentry.title' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by")

ONLY_FULL_GROUP_BY is either a new setting or has become set on by default in 5.7. I'm not familiar with MySQL so I don't know what's going on. I can't even see where Watson would be producing a group by clause, but it obviously is somewhere.

Example Travis job that fails: https://travis-ci.org/moggers87/django-watson/jobs/543435654

etianen commented 5 years ago

Thanks for the report! I don't have time to look into it at present. Hopefully yourself, or someone else, will find a solution!

etianen commented 4 years ago

It's a myself config issue. It doesn't happen with the Django recommended config.

https://github.com/etianen/django-watson/pull/261#issue-335327637

AlexDev1 commented 4 years ago

I had a struggle getting this to work i've tested it and it's working on lamp server mysql version 5.7 The problem was in MySql server settings So, steps to success: nano /etc/mysql/conf.d/mysql.cnf

Insert or change:

[mysqld]
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

save and exit input mode /etc/init.d/mysql restart

Done!