I accidentally enabled ONLY_FULL_GROUP_BY mode like this:
SET sql_mode = \'ONLY_FULL_GROUP_BY\';
How do I disable it?
To whom is running a VPS/Server with cPanel/WHM, you can do the following to permanently disable ONLY_FULL_GROUP_BY
You need root access (either on a VPS or a dedicated server)
Enter WHM as root and run phpMyAdmin
Click on Variables, look for sql_mode
, click on 'Edit' and copy the entire line inside that textbox
e.g. copy this:
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Connect to you server via SFTP - SSH (root) and download the file /etc/my.cnf
Open with a text editor my.cnf
file on your local PC and paste into it (under [mysqld]
section) the entire line you copied at step (2) but remove ONLY_FULL_GROUP_BY,
e.g. paste this:
# disabling ONLY_FULL_GROUP_BY
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Save the my.cnf
file and upload it back into /etc/
Enter WHM and go to "WHM > Restart Services > SQL Server (MySQL)" and restart the service