In this programming issue, the user encounters the error message "#1055 - Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column this is incompatible with sql_mode=only_full_group_by" while attempting to run a query in MySQL. To resolve this error, the user must modify the MySQL configuration file (mysql.cnf) to set the sql_mode parameter to STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION.
The user provides the following steps to successfully resolve the error:
sudo vim /etc/mysql/conf.d/mysql.cnf
[mysqld] sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
sudo service mysql restart
After completing these steps, the user should be able to execute the original query without encountering the error.
The above is the detailed content of How to Fix MySQL Error #1055: \'Expression of SELECT list is not in GROUP BY clause\'?. For more information, please follow other related articles on the PHP Chinese website!