I have 2 Mysql databases:
- #1 is created on Raspbian Raspberry pi 4
- #2 is created on virtual Ubuntu server.
I have been interacting with Mysql DB that is created by Raspberry pi 4 without any issues but now I want to migrate all the database to the virtual Ubuntu server to make my system more flexible.
After installing all the required modules on my ubuntu server, I have launched my python code and notice that it is not working properly. I get some mysql error regarding the GROUP BY statement:
mysql.connector.errors.ProgrammingError: 1055 (42000): Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test.Operation_1109360548.ID' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
The query that I am trying to execute:
sql = "SELECT Serial,ID,count(*) FROM {table} GROUP BY Serial"
cur.execute(sql.format(table=table_name))
And my database table looks like:
QUESTIONS
Could someone suggest why it would allow me to execute this query on mysql DB running on Raspbian but doesn't allow me on UBUNTU mysql?
How to solve this issue? I do not see any problems with this query. I have heard that you can modify mysql.cnf but that is not the best solution