哥伦布

博客园 首页 新随笔 联系 订阅 管理

目前主要是清理
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),'%')

posted on 2023-03-13 15:14  Caraxes  阅读(50)  评论(0)    收藏  举报