mysql 彻底解决:Incorrect string value: '\xF0\x9F\x98\xAD",...' for column 'commentContent' at row 1
彻底解决:Incorrect string value: '\xF0\x9F\x98\xAD",...' for column 'commentContent' at row 1
今天在爬取网易云音乐歌曲评论的时候,在将数据插入mysql数据库的时候,出现了Incorrect string value: '\xF0\x9F\x98\xAD",...' for column 'commentContent' at row 1 这个错误,Google了下发现原来是因为数据库编码问题导致的,原因在于我们的评论数据中存在emoj表情,而这些表情是按照四个字节一个单位进行编码的,而我们通常使用的utf-8编码在mysql数据库中默认是按照3个字节一个单位进行编码的,正是这个原因导致将数据存入mysql数据库的时候出现错误,那么这个问题我们应该怎么解决呢?
我分为下面五个步骤来解决:
(1):修改mysql数据库的编码为uft8mb4
(2):修改数据表的编码为utf8mb4
(3):
在mysql的安装目录下找到my.ini,作如下修改:
[mysqld]
character-set-server=utf8mb4
[mysql]
default-character-set=utf8mb4
修改后重启Mysql
(4).修改哪个字段为utf8mb4 编码(哪个字段是特殊的含有表情等字符的字段编码改为utf8mb4)
(5).实现数据导入的数据库中

是不是很操蛋的我真的醉啦 一个这个弄了一个早上 有时改数据库 有时改my.ini 文件 有时改字段的字符编码 有时改八爪鱼的配置 总之很麻烦
最后还是可以数据进入到数据库中的啦
mysql 彻底解决:Incorrect string value: '\xF0\x9F\x98\xAD",...' for column 'commentContent' at row 1的更多相关文章
- Incorrect string value: '\xF0\x9F\x98\xAD",...' for column 'commentContent' at row 1
我分为下面三个步骤来解决: (1):修改mysql数据库的编码为uft8mb4 (2):修改数据表的编码为utf8mb4 (3):修改连接数据库的连接代码 更改数据库编码:ALTER DATABASE ...
- java.sql.SQLException: Incorrect string value: '\xF0\x9F\x98\xB3' for column 'Content' at row 1
在尝试将 emoji 表情符号 插入MySQL数据库时,遇到以下错误信息: ### The error occurred while setting parameters ### SQL: INSER ...
- java.sql.SQLException: Incorrect string value: '\xF0\x9F\x98\x8E' for column 'nick' at row 1
java.sql.SQLException: Incorrect string value: '\xF0\x9F\x98\x8E' for column 'nick' at row 1 mysql报错 ...
- java.sql.SQLException: Incorrect string value: '\xF0\x9F\x98\x8E' for column 'name' at row 1
我的错误案例: ,这个后台插不进去,就姓名那栏的中文编码问题. 遇到这个错误,应该是创建表的时候没有设置好编码,这个错误不用多想,我也试过在更改表那里设置编码,但还是不行,还是有残留 直接drop t ...
- Django1.10+Mysql 5.7存储emoji表情,报Incorrect string value: '\\xF0\\x9F\\x90\\xA8' for column 'signature' at row 1的解决方法
问题: 在做webapp项目的时候,用户提交emoji数据,控制台报错:Incorrect string value: '\\xF0\\x9F\\x90\\xA8' for column 'signa ...
- 解决pymysql.err.InternalError: (1366, "Incorrect string value: '\\xF0\\x9F\\x8C\\xB8' for column 'headline' at row 1")
解决pymysql.err.InternalError: (1366, "Incorrect string value: '\\xF0\\x9F\\x8C\\xB8' for column ...
- 表情存储异常--mybatis抛出异常(java.sql.SQLException: Incorrect string value: '\xF0\x9F\x92\x94' for column 'name' at row 1)
文章参考 https://blog.csdn.net/junsure2012/article/details/42171035 https://www.cnblogs.com/WangYunShuai ...
- mybatis抛出异常(java.sql.SQLException: Incorrect string value: '\xF0\x9F\x92\x94' for column 'name' at row 1)
文章参考 https://blog.csdn.net/junsure2012/article/details/42171035 https://www.cnblogs.com/WangYunShuai ...
- 【MySQL】java.sql.SQLException: Incorrect string value: '\xF0\x9F\x98\xB3' for column
问题原因: 输入内容包含特殊字符,MySQL 中的列不支持. 解决方法 多数是修改 MySQL 的数据库和表结构,CHARSET 改为 utf8mb4,但本人测试还是不能传入 emoji. 后来在代码 ...
随机推荐
- FeiQ项目
一.映射表 UDPMeditor.h中: typedef void (UDPMeditor::*pFunc)(char*,long); struct ProtocolMap { PackdefType ...
- 安装oracle xe一些注意点
主要是web管理数据的的端口8080端口的问题, 会和tomcat冲突 安装时把开启8080端口的tomcat启动了 占用8080端口就行了, 然后安装oracle xe就会让你输入 web管理数据的 ...
- maven安装错误履历
1\:maven cannot find entry:"/src/main/java" 先删除source下的文件夹 再新建文件夹
- 张超超OC基础回顾01_类的创建,申明属性,以及本质
一. 类的声明和实现&规则 1.如何编写类的声明 以@interface开头 , 以@end结尾, 然后再class name对应的地方写上 事物名称, 也就是类名即可 注意: 类名的首字符必 ...
- jsoup 的简单应用
导入相关jar包 package jsoup.zr.com.utils; import java.io.IOException; import java.util.List; import org.j ...
- WCF把书读薄(3)——数据契约、消息契约与错误契约
上一篇:WCF把书读薄(2)——消息交换.服务实例.会话与并发 十二.数据契约 在实际应用当中数据不可能仅仅是以int Add(int num1, int num2)这种简单的几个int的方式进行传输 ...
- [GO]指针和函数配合的值传递
package main import "fmt" func swap(a, b int) { a, b = b, a fmt.Printf("a = %d, b = % ...
- 编写高质量代码改善C#程序的157个建议——建议48:Dispose方法应允许被多次调用
建议48:Dispose方法应允许被多次调用 一个类型的Dispose方法应该允许被多次调用而不抛出异常.鉴于此,类型内部维护了一个私有的bool变量disposed,如下: private bool ...
- Glide4.0使用
导入 dependencies { compile 'com.github.bumptech.glide:glide:4.0.0' compile 'com.android.support:suppo ...
- 初学reactNative遇到的问题总结
1.undefined is not an object (evaluating '_react3.default.PropTypes.shape') Navigator已经不再react nativ ...