Home > Database > Mysql Tutorial > How to solve the mysql error '#1067 invalid default value'

How to solve the mysql error '#1067 invalid default value'

醉折花枝作酒筹
Release: 2021-05-17 09:38:11
forward
4246 people have browsed it

This article will introduce to you how to solve the mysql error "#1067 invalid default value". It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

How to solve the mysql error '#1067 invalid default value'

Reminder: The information described in this article may have changed, please use it with caution.

Wordpress has deleted a lot of comments, resulting in a large gap in the comment ID. If you want to continue, use the following command to modify the auto-increment ID and count again:

The result is an error, prompt:

#1067 – Invalid default value for comment_date
Copy after login

I remember that there was no problem using this command before. After searching online, I found that it was a problem with mysql. I used to use mysql5.6, but I just upgraded it to 5.7 not long ago. The method online worked.

Directly follow the online tutorial to modify the mysql configuration file my.cnf, edit my.cnf

Add the following content under [mysqld]:

After saving, restart mysql, Execute the command to modify the auto-increment ID again, and everything will be normal.

There is also a temporary method mentioned on the Internet:

The reason for this problem is that the default value of comment_date is 0000-00-00 00:00:00. Check sql_mode, which contains "NO_ZERO_IN_DATE, NO_ZERO_DATE", the time limit of these two parameters cannot be 0, so an error will be reported!

Related recommendations: "mysql tutorial"

The above is the detailed content of How to solve the mysql error '#1067 invalid default value'. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template