(1) PHPMyAdmin
if you are using phpMyAdmin then change the "sql_mode" setting as mentioned in the below screenshot.
Edit "sql mode" variable and remove the "ONLY_FULL_GROUP_BY" text from the value
OR
(2) SQL/Command prompt Run the below command.
SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
OR
(3) Don't use SELECT *
Use relevant column in SELECT query. relevant means columns, which are either coming in "group by" clause or column with the aggregate function (MAX, MIN, SUM, COUNT etc)
Changes made by using point(1) OR point(2) does not set it PERMANENTLY, and it will revert after every restart.
So you should set this in your config file (e.g. /etc/mysql/my.cnf in the [mysqld] section), so that the changes remain in effect after MySQL restart:
Config File: /etc/mysql/my.cnf
Variable name : sql_mode OR sql-mode
Remove word ONLY_FULL_GROUP_BY from the value and save the file.
Note : If you have not found "sql_mode" variable in the config file than please insert below 2 lines at the end of the file
[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