There is no problem not worth solving, and no technology not worth learning!

In Navicat for MySQL, when the table is copied from one database to another, an error is reported:[ERR]1292 – Incorrect DateTime Value:0000-00-00 00:00:00for columnCREATED_AT_GMTAT ROW 1 (in MySQL 8.0)

在 Navicat for MySQL 中,将表从一个数据库复制至另一个数据库时,报错:[ERR] 1292 - Incorrect datetime value: '0000-00-00 00:00:00' for column 'created_at_gmt' at row 1

1. In Navicat for MySQL, when the table is copied from one database to another, an error is reported:[ERR]1292 – Incorrect DateTime Value:0000-00-00 00:00:00for columnCREATED_AT_GMTat row 1. as shown in Figure 1

在 Navicat for MySQL 中,将表从一个数据库复制至另一个数据库时,报错:[ERR] 1292 - Incorrect datetime value: '0000-00-00 00:00:00' for column 'created_at_gmt' at row 1
Figure 1

[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(), it is found that the version of the two database software is inconsistent. They are: 5.7.19-log and 8.0.23-0ubuntu0.20.04.1. as shown in Figure 2

执行:SELECT VERSION(),发现两个数据库软件的版本不一致。分别为:5.7.19-log 与 8.0.23-0ubuntu0.20.04.1
Figure 2

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

由于目标数据库是基于 Homestead 部署,编辑 Homestead.yaml,在 「features」 设置 中,添加:mysql8: false
Figure 3

features:
    - mysql: true
    - mariadb: false
    - postgresql: false
    - ohmyzsh: false
    - webdriver: false
    - mysql8: false


4. Destroy the virtual machine first: vagrant destroy –force, and then start vagrant: vagrant up. Still mysql 8 because the built-in software is already mysql 8. as shown in Figure 4

先销毁虚拟机:vagrant destroy --force,再 启动 vagrant:vagrant up。仍然是 MySQL 8,原因在于 内置软件 已经为 MySQL 8 了
Figure 4

5. Execute: show variables likesql_mode;, view the SQL mode. 5.7 is: Strict_trans_tables, no_auto_create_user, no_engine_substitution. 8.0 The following is: ONLY_FULL_GROUP_BY, Strict_Trans_Tables, NO_ZERO_IN_DATE, NO _zero_date, error_for_division_by_zero, no_engine_substitution. as shown in Figure 5

执行:SHOW VARIABLES LIKE 'sql_mode';,查看 SQL 模式。5.7 下为:STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION。8.0 下为:ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
Figure 5

6. Reset the sql mode under 8.0, delete: no_zero_in_date, no_zero_date, and keep the others. Then close the connection, then open the connection, and check the SQL mode, which has taken effect. as shown in Figure 6

重新设置 8.0 下的 SQL 模式,删除掉:NO_ZERO_IN_DATE,NO_ZERO_DATE,保留下其他的。然后关闭连接,再打开连接,查看 SQL 模式,已经生效
Figure 6

set GLOBAL sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';


7. Ctrl + C again, and then Ctrl + V in the target database, no more errors are reported. Figure 7, Figure 8

再次 Ctrl + C,然后在目标数据库中 Ctrl + V
Figure 7
不再报错
8

Need long-term technical maintenance or remote troubleshooting?

I am a PHP / Go backend engineer with 15+ years of experience, focused on existing system maintenance, bug fixing, performance optimization, server troubleshooting, WordPress maintenance, and small feature iterations.

If your project is facing any of the following issues, we can start with a small troubleshooting task first:

  • ✅ PHP / Laravel / Yii2 legacy systems without active maintenance
  • ✅ Go / Gin backend APIs that need troubleshooting or optimization
  • ✅ Slow, broken, or unstable WordPress websites
  • ✅ Nginx / MySQL / Redis / Linux server issues
  • ✅ CDN / Cloudflare / DNS / HTTPS configuration problems
  • ✅ Long-term remote technical support or part-time maintenance

More details: About Me & Collaboration

WeChat: 13980074657
Email: shuijingwanwq@gmail.com
Telegram: @shuijingwan
GitHub: https://github.com/shuijingwan

评论

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.