简体   繁体   English

在MySQL导出中将Blob转换为文本

[英]Convert blob to text in a mysql export

I'd have some blob data such as: 我会有一些Blob数据,例如:

0x3333332c2044e963617269652c20356520e9746167650d0a53742d4c617572656e7420285175e9626563292048344e20334d390d0a

that I'd like to convert to text because the new database has text field instead of blobs and now it makes trouble with some accentuated characters. 之所以要转换为文本,是因为新的数据库具有文本字段而不是blob,现在它使某些加重字符变得麻烦。

Is there somekind of blob to string converter somewhere? 在某处是否存在某种Blob到字符串转换器?

Thanks a lot! 非常感谢!

尝试:

CONVERT(blobname USING latin1)

It depends on what the blob is. 这取决于什么是斑点。 For example, I've dealt with some blobs that could be represented as basic XML files. 例如,我已经处理了一些可以表示为基本XML文件的Blob。 Those would have been relatively easy to convert. 这些将相对容易转换。 However, I dealt with other blobs that were image files. 但是,我处理的是图像文件的其他斑点。 If you tried to represent them as text you'd lose data. 如果您尝试将它们表示为文本,则会丢失数据。

What are in your blobs? 你的斑点是什么?

使用导出创建新数据库,完成后在表上创建文本列,然后使用CONVERT删除旧列进行更新,并根据需要重命名旧列。

如果使用phpmyadmin,请在导出页面底部的“以十六进制表示形式转储二进制列(例如,“ abc”变为0x616263”)框打钩。

但是,如果数据包含简单的字节流(即非结构化数据,文件,音频,视频等),并且您需要将它们表示为纯ASCII,则可以更改为Base64字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM