目前主要是清理
Mysql有时候会有一些异常字符导致数据导出失败。
发现异常字符的文字
通过如下脚本,数据库异常字符和正常字符的差异。得到异常字符的编号
SELECT hex(name),name,hex('姓名') FROM tablename where id= '51883';
替换异常字符为空格或删除
实际使用的时候主要遇到换行符和0x01符号
update tablename set description = replace(description, '\n', ' ') where description like '%\n%'
update tablename set description = replace(description, char(1), '') where description like concat('%',char(1),'%')
浙公网安备 33010602011771号