Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the mysql CLI tool provide a way to display binary data in a console-friendly manner?

Tags:

I have a MySQL database containing a table with a binary-typed column. I'd like to be able to project that column without having to run it through, e.g., HEX(). Does the mysql CLI tool have a configuration option or other means to display a representation of binary data in a manner that won't output arbitrary bytes for my console to interpret in hilarious/annoying ways?

like image 687
Richard Simões Avatar asked Mar 23 '12 15:03

Richard Simões


2 Answers

Start MySQL CLI with param --binary-as-hex

Example:

mysql --binary-as-hex
like image 190
Pradeep Avatar answered Jun 01 '23 19:06

Pradeep


Set mysql client options in /etc/my.cnf works for me:

[client]
binary-as-hex = true

[mysql]
binary-as-hex = true
like image 29
vr3C Avatar answered Jun 01 '23 17:06

vr3C