MySQL: 1366 incorrect string value
直接通过新建表后insert into数据,报错如下:
1366 incorrect string value
查看数据库表字段定义,编码格式一致,不知道该如何处理,思考也许是数据库编码格式问题,查询的命令如下:
show variables like ‘character%’;
没有发现异常。
决定另辟蹊径,即通过一条语句完成数据的查询以及表创建。
demo: create table newemp as select * from emp
create table repotest as select s.uuid as repo_uuid, r.url, repo_name, s.language, s.branch, s.repo_source, r.local_addr, s.download_status,latest_commit_time, s.project_name
,s.recycled,import_account_uuid,scan_start, is_private,description
from sub_repository as s , repository as r
where s.repo_uuid = r.uuid;
报错如下:
1786 statement violates gtid
查询得知:
这是因为在5.6及以上的版本内,开启了 enforce_gtid_consistency=true
功能导致的,MySQL官方解释说当启用 enforce_gtid_consistency
功能的时候,MySQL只允许能够保障事务安全,并且能够被日志记录的SQL语句被执行,像create table … select 和 create temporarytable语句,以及同时更新事务表和非事务表的SQL语句或事务都不允许执行。
CREATE TABLE ... SELECT
is not safe for statement-based replication. When using row-based replication, this statement is actually logged as two separate events — one for the creation of the table, and another for the insertion of rows from the source table into the new table just created.
When this statement is executed within a transaction, it is possible in some cases for these two events to receive the same transaction identifier, which means that the transaction containing the inserts is skipped by the slave. Therefore, CREATE TABLE ... SELECT
is not supported when using GTID-based replication.
尝试解决这一问题:
SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY = off;
或者将上述语句拆分成两句。
使用第一种方案失败。报错如下,无法轻易关闭此模式。
1779 gtid_mode
有点气馁,出现Y问题是为了解决X文件,回到X问题上,思考为什么插入失败,毫无疑问是数据编码格式,决定再次比对编码格式,刚刚在检索过程中得到查询表定义语言的sql如下:
show create table repo;
仔细比对repo、sub_repo以及repository表定义,发明
repo中编码格式定义与repository不一致。
CHARSET=utf8 COLLATE=utf8_bin
保持一致,重新通过表定义语言生成表。
插入成功!
Reference
mysql 官方文档
MySQL: 1366 incorrect string value相关推荐
- 【Mysql】1366 - Incorrect string value: ‘\xE9\x92\xB1\xE7\x94\xB5‘
插入数据时显示:1366 - Incorrect string value: '\xE9\x92\xB1\xE7\x94\xB5' 1.创建表的语句 1.创建表的语句 ##教师表 CREATE TAB ...
- 【mysql新加不了中文】Error Code: 1366. Incorrect string value: ‘\xE7\xBA\xB8\xE7\xB1\xBB‘ for colum
INSERT INTO garbage.type ( id, type,type_sub) VALUES ( 1, "纸类","属于可回收物" ) Error ...
- mysql客户端报错1366_mysql 错误提示1366 Incorrect string value怎么解决?
这个就是编码的问题,可能在装MySql 的时候选择的是默认的编码,或者你选择的UTF8,所以在插入数据的时候出现编码的错误.解决方法是找到Mysql的安装目录下的my.ini文件,把里面的defaul ...
- 【python解决SQLAlchemy+MySQL插入数据时报警告Warning: (1366, “Incorrect string value: ‘\\xD6\\xD0\\xB9\\xFA\\xB】
python解决SQLAlchemy+MySQL插入数据时报警告Warning: (1366, "Incorrect string value: '\xD6\xD0\xB9\xFA\xB1\ ...
- Navicat for Mysql数据导入时报错1366 - Incorrect string value: ‘\xE7\x90\xAD‘ for column ‘xx‘ at row xx
在 Navicat for Mysql 进行数据导入时 报错1366 - Incorrect string value: '\xE7\x90\xAD' for column 'xx' at row x ...
- python向Mysql存入数据1366, Incorrect string value: '\\xF0\\x9F\\x98\\xAC\\xE3\\x80...'
写的爬虫小项目,爬取贴吧帖子的标题和阅读量,将数据存入MySQL 错误信息: (1366, "Incorrect string value: '\\xF0\\x9F\\x98\\xAC\\x ...
- MySQL 调用存储过程 错误代码: 1366 Incorrect string value: '\xE7\x8E\x8B\xE4\xBA\x94'
在使用 mysql创建好存储过程,调用时出现错误: 错误代码: 1366 Incorrect string value: '\xE7\x8E\x8B\xE4\xBA\x94',由于1366是编码问题 ...
- MySQL数据库报错 > 1366 - Incorrect string value: ‘\xE6\xB1\x9F\xE6\x96\x87‘ for column ‘Teacher‘ at row 1
数据库报错这个多半是数据库在创建的时候没有选择字符编码,导致输入中文的时候出现报错. > 1366 - Incorrect string value: '\xE6\xB1\x9F\xE6\x96 ...
- sqlalchemy.exc.DataError: (pymysql.err.DataError) (1366, “Incorrect string value: ‘\\xE6问题解决
sqlalchemy.exc.DataError: (pymysql.err.DataError) (1366, "Incorrect string value: '\xE6\xA0\x87 ...
最新文章
- R语言数据热力图绘制实战(基于原生R函数、ggplot2包、plotly包)
- Python学习笔记-DNS处理模块dnspython
- ASP:在静态页面中显示文章被阅读的次数
- PHP PDO函数库详解
- 消息分发的同步均衡策略
- 荣耀6plus+android5.1,荣耀66Plus EMUI3.0开发版5.5.1版本发布说明
- IPC 中 LPC、RPC 的区别和联系
- eclipse插件开发(四) 流程图绘制插件(雏形)
- SAP License:学习到底学什么?
- Learning to Reconstruct 3D Human Pose and Shape via Model-fitting in the Loop
- Socket网络编程进阶与实战
- PHP 高并发秒杀解决方案
- fanuc机器人仿真软件roboguide-新建工程文件
- 查询中国天气网api需要用到的城市代码
- mysql fatch array_辩别WEB服务程序,,了解常见的几种脚本和数据库之间的搭配组合及特点...
- 蓝牙4.0 For IOS
- Encoded password does not look like BCrypt 异常问题
- IDEA 设置代码提示或自动补全的快捷键
- 新冠肺炎疫情数据可视化分析-FineBI
- hdu 3642 体积并
热门文章
- 对于雷诺数,你了解多少?
- 云计算课程大纲,Linux云计算运维课程视频
- 程序yuan开发-windows小工具:gif截图-LICEcap、文件查找-Everything、远程软件-TeamView、视频播放-PotPlayer、markdown编辑-Typora、
- 市值超万亿港元!那个CEO写下70万行代码的公司上市了
- 【硬十宝典】——1.2【基础知识】开关电源各种拓扑结构的特点
- ModemManager 1.10发布
- Docker 简明教程
- C# 开发Windows Service
- Mac OS 12.3系统版本使用AccessClient堡垒机跳转闪退问题记录
- Win7中设置共享文件夹(通过账户密码访问)