MySQL5.7 new group by feature error 1055 solution, mysql5.71055

Source: Internet
Author: User
Tags mysql command line

MySQL5.7 new group by feature error 1055 solution, mysql5.71055

The project was originally developed using mysql5.6. After switching to 5.7, it suddenly found that some of the original SQL statements run with an error code of 1055. The error message is related to "only_full_group_by" in SQL _mode, I read the reason online, saying that the only_full_group_by mode in mysql5.7 is enabled by default.
There are two solutions:

I. Use the any_value () function on fields that do not require group by in SQL query statements.

Of course, this is not suitable for projects that have developed many functions. After all, you must modify all the original SQL statements.

2. modify the configuration file my. cnf (my. ini in windows) and delete only_full_group_by.

Mysql of our project is installed on ubuntu. Find this file and open it. There is no SQL _mode configuration item in it. If you want to delete it, you will not have to delete it.

Of course, there are other ways to open the mysql command line and execute the command

select @@sql_mode

In this way, you can find the SQL _mode value, copy the value, and add the configuration item in my. cnf (delete the queried value from the only_full_group_by option, and copy the other values ):

sql_mode=STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

If the [mysqld] line is commented out, remember to open the comment. Restart the mysql service.

Note: use commands

set sql_mode=STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

In this way, you can modify the configuration items in one session, which does not take effect in other sessions.

The above is a small series of solutions to the new MySQL5.7 group by error 1055. I hope it will help you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.