Command, Fix, MySql

MYSQL: Syntax error or access violation: 1055

So upgraded mysql to new version and started seeing these warnings:

PHP Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘db.column_name’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible

Method 1:

We can fix it by setting sql_mode via sshing:

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


1- Open root’s ssh session:

2- Then type mysql: and hit enter:

3- And then copy/paste above command and then again hit enter. you will see query ran successfully message:

Hope this helps somebody to save few minutes.

Method 2:

Open nano /etc/my.cnf file and add following line and save it:


And then restart mysql service.

Leave a Reply

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