Disable SQL Full Group By Mode Permanently

How to disable sql mode ONLY_FULL_GROUP_BY mode permanently?

Using the following SQL query will disable the SQL Full Group by Mode only for temporary. i.e., If you restart the server the original values are restored back.

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

To disable permanently,

Edit the my.cnf file.

Login to your server console/terminal.

Edit the MySQL configuration file my.cnf

sudo nano /etc/mysql/my.cnf

Add the following lines at the end of the file.

[mysqld]
sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
MySQL my.cnf Configuration file

Save the file (ctrl + x, Y) and restart the server

sudo service mysql restart

Please follow and like us:

Recommended Articles

Leave a Reply

Your email address will not be published. Required fields are marked *