Problem with SQL mode, disable sql_mode: ONLY_FULL_GROUP_BY
Disabling sql_mode: ONLY_FULL_GROUP_BY, in case of MYSQL: disable sql_mode: ONLY_FULL_GROUP_BY
sql_mod ONLY_FULL_GROUP_BY should be disabled. To do that follow steps bellow. In most pre-configured web hosts it is done by default, and this tutorial is mostly for advanced users with VPS and dedicated servers.
You can do that by editing /etc/mysql/my.cnf and setting:
nano /etc/mysql/my.cnf
[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"
for mysql 8
[mysqld]
sql_mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
value of sql_mode should be created by getting defaults using query:
root@hz:~# mysql -e "SELECT @@sql_mode"
+-------------------------------------------------------------------------------------------------------------------------------------------+
| @@sql_mode |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------------------------------------------------------+
and removing ONLY_FULL_GROUP_BY from returned value