Home>Article>Database> What should I do if mysql5.7 reports error 1055?

What should I do if mysql5.7 reports error 1055?

藏色散人
藏色散人 Original
2020-10-26 09:05:01 2730browse

Mysql5.7 error 1055 solution: First find and open the my.cnf configuration file; then delete the "only_full_group_by" item, or open the mysql command line and execute the command "select @@sql_mode" that is Can.

What should I do if mysql5.7 reports error 1055?

Recommended: "mysql tutorial"

mysql5.7 Error 1055

MySQL5.7 group by new features, error 1055

The project originally used mysql5.6 for development. After switching to 5.7, I suddenly found that some of the original sql operations were not running. Error report, error code 1055, the error message is related to "only_full_group_by" in sql_mode. I read the reason online and it is said that the only_full_group_by mode is enabled by default in mysql5.7. There are roughly two solutions:

1 : Use the any_value() function on fields that do not require group by in the SQL query statement

Of course, this is not suitable for projects that have developed many functions. After all, the original SQL must be modified. Once again

Two: Modify the my.cnf (my.ini under windows) configuration file and delete the only_full_group_by item

The mysql of our project is installed on ubuntu, find this file and open it Look, there is no sql_mode configuration item in it, so you don’t have to delete it if you want.

Of course, there are other ways. Open the mysql command line and execute the command

select @@sql_mode

so that you can find out the value of sql_mode, copy this value, and add configuration items in my.cnf ( Delete the only_full_group_by option from the queried value, and copy the others):

sql_mode=STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

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

Note: Use the command

set sql_mode=STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

to modify the configuration items in one session, which will not take effect in other sessions.

The above is the detailed content of What should I do if mysql5.7 reports error 1055?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn