Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bit data type column output from mysqldump (SQL)

I'm using bit(1) to represent a boolean but when I dump the table into a file using mysqldump, the outputted data doesn't appear in the format that I expect.

What I see in the table (phpMyAdmin):

0    1

What I see in the file (mysqldump):

SOH    \0

What I see if I use the export feature of phpMyAdmin:

b'0'    b'1'

Do I need to use a flag or is this a safe representation of the bit data type?

like image 625
user8056359 Avatar asked Feb 11 '26 17:02

user8056359


1 Answers

Add --hex-blob option to your mysqldump command.

It means dump binary columns using hexadecimal notation. Then it becomes human-readable in your file.

like image 102
walter Avatar answered Feb 13 '26 08:02

walter



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!