Skip to content

How to disable the ONLY_FULL_GROUP_BY SQL Mode for a single cpanel user

You are here:
< All Topics
Table of Contents

The ONLY_FULL_GROUP_BY SQL mode is a setting in the MySQL database management system that affects the behavior of GROUP BY clauses in SQL queries.

When this mode is enabled, the results of a GROUP BY clause must be based on a complete set of grouped columns. This means that all columns in the SELECT list not contained in an aggregate function (e.g. SUM, AVG, COUNT) must be included in the GROUP BY clause.

If ONLY_FULL_GROUP_BY is disabled, MySQL will allow non-aggregate columns in the SELECT list that are not part of the GROUP BY clause, and will return arbitrary values for those columns.

This behavior can lead to incorrect results, so it is generally recommended to keep ONLY_FULL_GROUP_BY enabled to catch mistakes and improve the quality of your database queries.

Is it a good practice to disable MYSQL SQL_MODE ONLY_FULL_GROUP_BY?

Whether to disable the ONLY_FULL_GROUP_BY SQL mode depends on the requirements and restrictions of your database system. Here are some points to consider:

  • Enabling ONLY_FULL_GROUP_BY ensures that the results of a GROUP BY clause are based on a complete set of grouped columns and eliminates any unexpected or incorrect results.
  • Disabling ONLY_FULL_GROUP_BY can be necessary for compatibility with older database systems that may have used non-standard GROUP BY behavior.
  • In general, it is a good practice to keep ONLY_FULL_GROUP_BY enabled, as it helps to catch mistakes and improve the quality of your database queries.
  • However, if you need to use a specific database query that would not work with ONLY_FULL_GROUP_BY enabled, you may need to temporarily disable the mode.

to disable the ONLY_FULL_GROUP_BY mode for a single cPanel user.

it is possible to disable the ONLY_FULL_GROUP_BY mode for a single cPanel user.

Here’s how you can disable the ONLY_FULL_GROUP_BY mode for a single cPanel user from WHM:

  1. Log in to WHM as a root user.
  2. Go to the “SQL Services” section.
  3. Click the “MySQL Configuration Editor” link.
  4. In the “Configuration File” section, select the “my.cnf” file.
  5. In the “Section” section, select the “mysqld” option.
  6. Scroll down to the “Directives” section and find the “sql_mode” directive.
  7. Change the value of the “sql_mode” directive to exclude ONLY_FULL_GROUP_BY. For example, if the value is sql_mode = "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES", change it to sql_mode = "STRICT_TRANS_TABLES".
  8. Click the “Save” button to save the changes.
  9. Restart the MySQL service to apply the changes.

After following these steps, the ONLY_FULL_GROUP_BY mode will be disabled for all cPanel users. To restrict the changes to a single cPanel user, you will need to create a separate MySQL instance for that user with a modified my.cnf file.

Leave a Reply

Table of Contents