I have disabled ONLY_FULL_GROUP_BY
by using SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
. Now I want to restore the default settings.
Is it possible to enable the ONLY_FULL_GROUP_BY
in MySQL again?
Thanks in advance
If ONLY_FULL_GROUP_BY is disabled, a MySQL extension to the standard SQL use of GROUP BY permits the select list, HAVING condition, or ORDER BY list to refer to nonaggregated columns even if the columns are not functionally dependent on GROUP BY columns. This causes MySQL to accept the preceding query.
To turn it ON, add STRICT_TRANS_TABLES on that line like this: sql_mode=STRICT_TRANS_TABLES .
To change the SQL mode at runtime, set the global or session sql_mode system variable using a SET statement: SET GLOBAL sql_mode = 'modes'; SET SESSION sql_mode = 'modes'; Setting the GLOBAL variable requires the SUPER privilege and affects the operation of all clients that connect from that time on.
To avoid problems with other configurations, use CONCAT:
SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode, ',ONLY_FULL_GROUP_BY'));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With