Replacing the code should have been a permanent fix, can you please check your server error logs.
Leaving that, if you want that configuration which you achieved by running the query to remain permanent, open the mysql configuration file, usually present in /etc/mysql/my.cnf
Find the section named [mysql]
You should be able to find ONLY_FULL_GROUP_BY in sql_mode variable, just remove that.
It is a bit confusing, so if you don't understand, send me the file, I will help you with the changes.