Navicat runs the sql file and reports an error of Incorrect datetime value (in Windows environment)

Navicat reports error "Incorrect datetime value: '0000-00-00 00:00:00' for column 'addtime' at row 1" when running the SQL file

Background: The project was a long time ago. Recently, there is a need to re-run it. Use Navicat to import the original sql file and report an error: Incorrect datetime value: '0000-00-00 00:00:00' for column 'addtime' at row 1
Baidu learned that: mysql5.7 and above versions are more strict.
Reference link: https://www.cnblogs.com/1010wjf/p/13163164.html

The solution (simple and rude by me):

1. Open the Mysql configuration file my.iniand add at the bottom:

sql_mode=''

Then restart mysql, try to import the sql file again, and the import is successful.
2. Generally, it is not recommended to change the configuration file, so after importing the database, I my.inideleted sql_mode=''it, hehehe~
The project can still run now, I don’t know if there are any hidden dangers. . . . . .
3. Use Navicat to view the sql_mode of the current mysql database:
click Query , create a new query , enter select @@sql_mode;
(you can also directly enter the mysql database to check, see the habit)
insert image description here
insert image description here
first attach a very detailed blog, and organize it next time.
Link: https://blog.csdn.net/haibo0668/article/details/99749392

Guess you like

Origin blog.csdn.net/problemRecord/article/details/120065333