1. In Navicat for MySQL, when copying a table from one database to another, an error occurs: [ERR] 1292 – Incorrect datetime value: ‘0000-00-00 00:00:00’ for column ‘created_at_gmt’ at row 1. See Figure 1.
![In Navicat for MySQL, when copying a table from one database to another, an error occurs: [ERR] 1292 - Incorrect datetime value: '0000-00-00 00:00:00' for column 'created_at_gmt' at row 1](https://media.shuijingwanwq.com/2022/09/1-15.png)
[DTF] Drop table: `attribute_names`
[DTF] Create table: `attribute_names`
[DTF] Begin transaction on target server
[DTF] Start transfer data for table: `attribute_names`
[ERR] 1292 - Incorrect datetime value: '0000-00-00 00:00:00' for column 'created_at_gmt' at row 1
[DTF] End transaction on target server
[DTF] Finished unsuccessfully
2. Execute: SELECT VERSION(), and I find that the versions of the two database software are different. They are: 5.7.19-log and 8.0.23-0ubuntu0.20.04.1. See Figure 2.

3. Since the target database is deployed based on Homestead, edit Homestead.yaml and add: mysql8: false in the “features” settings. See Figure 3.

features:
- mysql: true
- mariadb: false
- postgresql: false
- ohmyzsh: false
- webdriver: false
- mysql8: false
4. First destroy the virtual machine: vagrant destroy –force, then start vagrant: vagrant up. It is still MySQL 8, because the built-in software is already MySQL 8. See Figure 4.

5. Execute: SHOW VARIABLES LIKE ‘sql_mode’; to check the SQL mode. Under 5.7 it is: STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION. Under 8.0 it is: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION. See Figure 5.

6. Reset the SQL mode under 8.0, remove: NO_ZERO_IN_DATE,NO_ZERO_DATE, and keep the others. Then close the connection, reopen the connection, and check the SQL mode; it has taken effect. See Figure 6.

set GLOBAL sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
7. Press Ctrl + C again, then press Ctrl + V in the target database, and no error occurs anymore. See Figure 7 and Figure 8.


