Disable ONLY_FULL_GROUP_BY

后端 未结 27 1315
既然无缘
既然无缘 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 01:07

    I'm using doctrine and I have added the driverOptions in my doctrine.local.php :

    return array(
    'doctrine' => array(
        'connection' => array(
            'orm_default' => array(
                'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
                'params' => array(
                    'host' => 'localhost',
                    'port' => '3306',
                    'user' => 'myusr',
                    'password' => 'mypwd',
                    'dbname' => 'mydb',
                    'driverOptions' => array(
                        PDO::MYSQL_ATTR_INIT_COMMAND => "SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''))"
                    ),
                ),
            ),
        ),
    ));
    

    In phpmyadmin the user needs SUPER activated in the privileges.

提交回复
热议问题