Disable ONLY_FULL_GROUP_BY

后端 未结 27 1376
既然无缘
既然无缘 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:56

    This is a permanent solution for MySql 5.7+ on Ubuntu 14+:

    $ sudo bash -c "echo -e \"\nsql_mode=IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION\"  >> /etc/mysql/mysql.conf.d/mysqld.cnf"
    $ sudo service mysql restart
    # Check if login attempt throws any errors
    $ mysql -u[user] -p # replace [user] with your own user name
    

    If you are able to login without errors - you should be all set now.

提交回复
热议问题