Disable ONLY_FULL_GROUP_BY

后端 未结 27 1347
既然无缘
既然无缘 2020-11-22 00:22

I accidentally enabled ONLY_FULL_GROUP_BY mode like this:

SET sql_mode = \'ONLY_FULL_GROUP_BY\';

How do I disable it?

27条回答
  •  醉酒成梦
    2020-11-22 00:52

    Adding only one mode to sql_mode without removing existing ones:

    SET sql_mode=(SELECT CONCAT(@@sql_mode,','));
    

    Removing only a specific mode from sql_mode without removing others:

    SET sql_mode=(SELECT REPLACE(@@sql_mode,'',''));
    

    In your case, if you want to remove only ONLY_FULL_GROUP_BY mode, then use below command:

    SET sql_mode=(SELECT REPLACE(@@sql_mode, 'ONLY_FULL_GROUP_BY', ''));
    

    Reference: http://johnemb.blogspot.com/2014/09/adding-or-removing-individual-sql-modes.html

提交回复
热议问题