如何从数据库中删除十六进制字符?
我有一个 MySQL 数据库,其中行包含 %20、%2C 等字符... 如何在不编辑记事本上的文件的情况下从数据库中删除它们? .sql 文件大小约为 300mb... 谢谢
i have a MySQL DB where the rows have characters like %20, %2C, etc...
how can i remove them from the DB without editing the file on notepad?
The .sql file is about 300mb in size...
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
什么数据库?
您想用正确的字符替换代码吗?就像 %20 加上“ ”(空格)?
您可能需要准确查看文本是如何转义的,但是您可以使用内置字符串函数天真地执行某些操作:
http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_replace
http://dev.mysql.com/doc/refman/5.1/en/string-functions .html#function_unhex
另外,我会采取措施确保此类数据不会以任何插入/导入机制进入数据库。
What database?
Do you want to replace codes with their proper characters; like %20 with ' ' (space)?
You may need to look at exactly how your text is escaped, but you can naively do something using builtin string functions:
http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_replace
http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_unhex
Also, I would take measures to ensure that this kind of data does not get into the database in whatever insert/import mechanism was used.