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.

4
  • 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. Commented Feb 1, 2020 at 6:05
  • I have seen other answers which say that it has to be restarted. I am confused now Commented Feb 1, 2020 at 6: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. Commented Feb 1, 2020 at 8: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. Commented Feb 1, 2020 at 8:15

1 Answer 1

3

Try

sudo systemctl restart mysql

Or

sudo service mysql restart

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.