如何在 MySQL Workbench 中直接查看 blob
我正在使用 MySQL Workbench CE 5.2.30 CE/Rev 6790 。当执行以下语句时:
SELECT OLD_PASSWORD("test")
我只得到一个漂亮的 BLOB
图标,我需要左键单击以选择单元格,右键单击并选择“在查看器中打开值”并选择“文本”选项卡。
使用与 phpMyAdmin 相同的方法,我可以直接返回 OLD_PASSWORD
调用的值。这只是一个例子,但是有没有办法直接在输出中看到这样的结果呢?
I'm using MySQL Workbench CE 5.2.30 CE / Rev 6790 . When execute the following statement:
SELECT OLD_PASSWORD("test")
I only get back a nice BLOB
icon, I need to left-click to select the cell, right-click and choose "Open Value in viewer" and select the "Text" tab.
Using the same with phpMyAdmin, I get directly back the value of the OLD_PASSWORD
call. It's just an example, but is there a way to directly see such results in the output?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(12)
简而言之:
在 MySQL Workbench 6.0+ 中
在旧版本的 MySQL Workbench 中
通过此设置,您将能够连接字段而无需获取 blob。
我认为这适用于版本 5.2.22 及更高版本,并且是 此 MySQL bug。
免责声明:我不知道此设置的缺点是什么 - 也许当您选择
BINARY
/VARBINARY
值时,您会将其视为纯文本,这可能会产生误导,并且/或者如果它们足够大的话可能会影响性能?In short:
In MySQL Workbench 6.0+
In older versions of MySQL Workbench
With this setting you will be able to concatenate fields without getting blobs.
I think this applies to versions 5.2.22 and later and is the result of this MySQL bug.
Disclaimer: I don't know what the downside of this setting is - maybe when you are selecting
BINARY
/VARBINARY
values you will see it as plain text which may be misleading and/or maybe it will hinder performance if they are large enough?我不确定这是否回答了问题,但如果您右键单击字段中的“blob”图标(查看表格时),则会出现“在编辑器中打开值”的选项。其中一个选项卡可让您查看该 blob。这是在版本中。 5.2.34
I'm not sure if this answers the question but if if you right click on the "blob" icon in the field (when viewing the table) there is an option to "Open Value in Editor". One of the tabs lets you view the blob. This is in ver. 5.2.34
执行三个步骤:
转到“WorkBench Preferences”-->选择“查询结果”下的“SQL编辑器”:选中“将BINARY/VARBINARY视为非二进制字符串”
重新启动 MySQL WorkBench。
现在选择
SELECT SUBSTRING(,1,2500) FROM;
Perform three steps:
Go to "WorkBench Preferences" --> Choose "SQL Editor" Under "Query Results": check "Treat BINARY/VARBINARY as nonbinary character string"
Restart MySQL WorkBench.
Now select
SELECT SUBSTRING(<BLOB_COLUMN_NAME>,1,2500) FROM <Table_name>;
就我而言,工作台不起作用。所以我使用上面的解决方案将 blob 数据显示为文本。
In my case, Workbench does not work. so i used the above solution to show blob data as text.
转换有效,但很痛苦,所以我建议使用 spioter 的方法,除非您使用大量真正的 blob 数据。
你还可以转换为其他类型,甚至限制大小,但大多数时候我只使用 CHAR:
http://dev.mysql.com/doc/refman /5.5/en/cast-functions.html#function_cast
casting works, but it is a pain, so I would recommend using spioter's method unless you are using a lot of truly blob data.
You can also cast as other types, and even restrict the size, but most of the time I just use CHAR:
http://dev.mysql.com/doc/refman/5.5/en/cast-functions.html#function_cast
恐怕这似乎不可能,它被列为工作台中的错误:
http://bugs.mysql.com/bug.php?id=50692
不过这会非常有用!
Doesn't seem to be possible I'm afraid, its listed as a bug in workbench:
http://bugs.mysql.com/bug.php?id=50692
It would be very useful though!
有同样的问题,根据MySQL文档,你可以选择 BLOB 的子字符串:
HTH、glissi
had the same problem, according to the MySQL documentation, you can select a Substring of a BLOB:
HTH, glissi
我将其他一些帖子拼凑在一起,因为工作台“首选项”修复对我不起作用。 (世界银行 6.3)
I pieced a few of the other posts together, as the workbench 'preferences' fix did not work for me. (WB 6.3)
工作台6.3
遵循高分答案,然后使用
UNCOMPRESS()
(简而言之:
1. 转到编辑>偏好设置
2.选择SQL编辑器
3. 在“SQL 执行”下,选中“将 BINARY/VARBINARY 视为非二进制字符串”
4. 重新启动 MySQL Workbench(不会提示或通知您此要求)。)
然后
或者
如果您只是输入
UNCOMPRESS()
您可以右键单击 blob 并单击“Open Value in编辑”。Work bench 6.3
Follow High scoring answer then use
UNCOMPRESS()
(In short:
1. Go to Edit > Preferences
2. Choose SQL Editor
3. Under SQL Execution, check Treat BINARY/VARBINARY as nonbinary character string
4. Restart MySQL Workbench (you will not be prompted or informed of this requirement).)
Then
or
If you just put
UNCOMPRESS(<COLUMN_NAME>)
you can right click blob and click "Open Value in Editor".您可以做的事情很少,
如果您想按查询排序,
您也可以按强制转换排序,如下所示,如本博客中所述
http://www.kdecom.com/mysql-group-concat-blob-bug-solved/
there is few things that you can do
If you want to order by the query you can order by cast as well like below
as it says on this blog
http://www.kdecom.com/mysql-group-concat-blob-bug-solved/
注意:如果 BLOB 是任意字节序列,则前面的答案并不是特别有用。例如 BINARY(16) 存储 128 位 GUID 或 md5 校验和。
在这种情况下,目前没有编辑器首选项——尽管我现在已经提交了功能请求 - 请参阅该请求以获取更详细的解释。
[直到/除非实现该功能请求],解决方案是查询中的
HEX
函数:SELECT HEX(mybinarycolumn) FROM mytable
。另一种方法是使用 phpMyAdmin 而不是 MySQL Workbench - 默认显示十六进制。
NOTE: The previous answers here aren't particularly useful if the BLOB is an arbitrary sequence of bytes; e.g. BINARY(16) to store 128-bit GUID or md5 checksum.
In that case, there currently is no editor preference -- though I have submitted a feature request now -- see that request for more detailed explanation.
[Until/unless that feature request is implemented], the solution is
HEX
function in a query:SELECT HEX(mybinarycolumn) FROM mytable
.An alternative is to use phpMyAdmin instead of MySQL Workbench - there hex is shown by default.
你可以尝试
You can try