Solution MySQL ERROR 1055 (42000)

Recently performed the necessary SQL queries and noticed the following error:

ERROR 1055 (42000): Expression #4 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'database_name.table_name.column_name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

To solve the error, connect to the mysql server:

mysql -u root -p

Execute a query that displays the values of sql_mode:

show variables like 'sql_mode';

At me it was displayed:


Copy the string with these values, remove “ONLY_FULL_GROUP_BY” and execute the query:


By this request, we disabled “ONLY_FULL_GROUP_BY” and after that the error will not be displayed.

So that this error does not appear later, we exit mysql:


Open the MySQL configuration file, for example, in the text editor nano (Ctrl + X for exit, y/n for saving or canceling changes):

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

I did not have sql_mode= in the file, so at the end of the file I inserted the line with the previously copied values, removing from it ONLY_FULL_GROUP_BY, in my case, the following happened:


Restart mysql to apply the changes:

sudo service mysql restart


Leave a comment

Leave a Reply