当前位置:网站首页>MySQL数据迁移遇到的一些错误
MySQL数据迁移遇到的一些错误
2022-07-01 05:38:00 【涟漪海洋】
背景
在做MYSQL数据库移植的时候,遇到一些问题,把这些问题记录下来,以备后查
sql_mode
很多校验都和这个mode有直接关系
## 导入sql文件,发生如下错误
MySQL:[Err] 1292 - Incorrect datetime value: '0000-00-00 00:00:00' for column 'CREATE_TIME' at row 1诱因
这是由于当前的MySQL不支持datetime为0的状况。
通过一下命令查选当前的sql_mode
select @@global.sql_mode;
解决方式
设置当前的sql_mode
## 当前
set @@sql_mode = 'STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';进入mysql命令界面执行一下命令
## 全局
set @@global.sql_mode = 'STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';PS:以上两种方式都能暂时解决问题,但是当数据库重启之后,之前做的修改会失效
修改my.ini配置文件
只有修改配置文件,才能永久的解决这个问题,在my.ini文件中追加
sql_mode = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION重新执行 select @@global.sql_mode;

一直报表格不存在的错
确认表格存在,但是查询一直报表格不存在报错,此时可能是因为以为mysql对大小写敏感导致的,可以修改该配置
在my.ini文件中追加以下代码
## 使用该命令查看当前系统中的大小写敏感配置
show global variables like '%case%';## lower_case_file_system 系统是大小写敏感的-不需要改
## lower_case_table_names 当前是大小写敏感的,需要改成1
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| lower_case_file_system | OFF |
| lower_case_table_names | 0 |
+------------------------+-------+
2 rows in set (0.01 sec)
lower_case_table_names = 1增加配置之后,重启服务再次查看
问题得以解决,如果是不在配置文件中配置,会在下次服务重启,使得之前的配置失效,产生一些不太好排查的问题,所以,如果不是特意需要暂时修改的话,都在配置文件中修改
边栏推荐
- 基于微信小程序的青少年生理健康知识小助手(免费获取源码+项目介绍+运行介绍+运行截图+论文)
- 加密狗资料搜集
- Set set detailed explanation
- 数据治理:元数据管理实施(第四篇)
- Variable binding and deconstruction for rudimentary rust
- Mongodb學習篇:安裝後的入門第一課
- Unity uses SQLite
- Rust hello-word
- Educational administration management system (free source code)
- libpng12.so.0: cannot open shared object file: No such file or directory 亲测有效
猜你喜欢

Redis database deployment and common commands
![[medical segmentation] u2net](/img/b3/b1d188216310fe1217e360ac56af3b.jpg)
[medical segmentation] u2net

Boot + jsp University Community Management System (with source Download Link)

OneFlow源码解析:算子签名的自动推断

Unity项目心得总结
![[excel] column operation, which performs specific column for data in a cell, such as text division by comma, colon, space, etc](/img/c8/e3e31ad9ef214d97228cb501dd752f.jpg)
[excel] column operation, which performs specific column for data in a cell, such as text division by comma, colon, space, etc

Detailed explanation of set

Understand several related problems in JVM - JVM memory layout, class loading mechanism, garbage collection

College community management system based on boot+jsp (with source code download link)

从底层结构开始学习FPGA----RAM IP的定制与测试
随机推荐
Vscode function annotation / file header annotation shortcut
数据库连接池的简单实现
新手在挖财开通证券账户安全吗?
JSON data comparer
基于微信小程序的青少年生理健康知识小助手(免费获取源码+项目介绍+运行介绍+运行截图+论文)
HDU - 1069 Monkey and Banana(DP+LIS)
Fluentd is easy to use. Combined with the rainbow plug-in market, log collection is faster
Series of improving enterprise product delivery efficiency (1) -- one click installation and upgrade of enterprise applications
Speed regulation and stroke control based on Ti drv8424 driving stepper motor
CentOS 7使用yum安装PHP7.0
Ssm+mysql second-hand trading website (thesis + source code access link)
Design and application of immutable classes
Variable binding and deconstruction for rudimentary rust
Dynamic verification of new form items in El form; El form verifies that the dynamic form V-IF does not take effect;
Day 05 - file operation function
Geoffrey Hinton:我的五十年深度学习生涯与研究心法
Wild melon or split melon?
提高企业产品交付效率系列(1)—— 企业应用一键安装和升级
Simple implementation of database connection pool
Qt编译时,出现 first defined here,原因及解决方法