problem
When importing data navicat, given:
[Err] 1292 - Incorrect datetime value: '0000-00-00 00:00:00' for column 'CREATE_TIME' at row 1
the reason
This is because the current MySQL does not support datetime 0. situation.
solve
Modify sql_mode:
sql_mode: SQL Mode defines the MySQL should support the SQL syntax, data validation, etc. This makes it easier to use MySQL in different environments.
Global sql_mode
View Global sql_mode:
select @@global.sql_mode;
We can see, O_ZERO_DATE, the NO_ZERO_IN_DATE , these two settings removed.
Modify global sql_mode:
set @@global.sql_mode = 'STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
Current sql_mode
View current sql_mode:
select @@sql_mode;
Modify the current sql_mode:
set @@sql_mode = 'STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
OK, problem solved.
While the above may also solve our problems, but once the restart MySQL, you must reset the time and the current global sql_mode.
Modify the configuration sql_mode
Sql_mode modify configuration MySQL configuration file mysql.ini in, you do not have to re-set each restart MySQL sql_mode up.
- Close MySQL
net stop MySQL57
- MySQL configuration modifications
in the my.ini [mysqld] was added under:
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
- Start MySQL
net start MySQL57
reference:
[1]: https: //my.oschina.net/shadowolf/blog/3005188
[2]: https: //www.cnblogs.com/mmyy-blog/p/9626326.html
[3]: MySQL affairs, lock , SQLMode, partition