0

I am getting an error in mysql

Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'returntr_prod.tbl_customer_pod_uploads.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

for which I found that I need to change the sql mode using

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

I have executed the above in the mysql terminal and after executing this it is suggested to restart the mysql service. So I have come out of mysql terminal to ubuntu terminal and tried to execute

sudo restart mysql 

I get an error message sudo: restart: command not found. Can someone help me understand why am I getting this error.

chink
  • 1,505
  • 3
  • 28
  • 70
  • You don't need to restart after using `SET GLOBAL` to change that option. In fact, it will make your change revert to whatever is set in `/etc/my.cnf`. – Bill Karwin Feb 01 '20 at 06:05
  • I have seen other answers which say that it has to be restarted. I am confused now – chink Feb 01 '20 at 06:35
  • If you edit the `/etc/my.cnf`, those changes won't take effect until you restart the mysqld server. Maybe that's what you read about. The settings in `/etc/my.cnf` are read only at startup. Then subsequently, you can change the settings with `SET GLOBAL` (most options can be changed dynamically, but not all). Then the next time you restart, any of those changes you made with `SET GLOBAL` are "lost" because the restart will read `/etc/my.cnf` again at startup. – Bill Karwin Feb 01 '20 at 08:14
  • So some people use `SET GLOBAL` _and_ also edit the `/etc/my.cnf` to the same value for the respective option, so the next restart will restore the desired setting. – Bill Karwin Feb 01 '20 at 08:15

1 Answers1

2

Try

sudo systemctl restart mysql

Or

sudo service mysql restart

Beach Chicken
  • 368
  • 3
  • 13