Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of Incorrect datetime value error in mysql

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of "how to solve the Incorrect datetime value error problem of mysql". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope this article "how to solve the Incorrect datetime value error problem of mysql" can help you solve the problem.

Cause of occurrence:

This error occurs due to problems with mysql version 5.7 and above:

The default sql configuration for mysql version 5.7 is: sql_mode= "ONLY_FULL_GROUP_BY", which strictly adheres to the "SQL92 standard".

When upgrading from 5.6 to 5.7, for syntax compatibility, most of them choose to adjust sql_mode to keep it consistent with 5.6, in order to be compatible with programs as much as possible.

Sql level

This reason occurs when sql executes:

To put it simply:

The output is called target list, which is the field followed by select, and there is another place, group by column, which is

The fields that follow the group by. Because the setting of ONLY_FULL_GROUP_BY is enabled, if a field is not in target list

If it appears at the same time as the group by field, or if it is the value of the aggregate function, then the sql query is considered illegal by mysql and will report an error.

Solution.

Modify the mysql.ini file

Add under [mysqld] configuration

Sql-mode= "STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"

Restart mysql

This is the end of the content about "how to solve the Incorrect datetime value error problem of mysql". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report