Reputation: 18010
I have downloaded a wikipedia dump file and transferred its data to MySQL.
SELECT page_id, BINARY CONVERT(page_restrictions USING utf8) from page
I used following query to convert page_restrictions
field from blob to string.
I also tried to use following to read old_text
value but it do not works.
SELECT BINARY CONVERT(old_text USING utf8) from text
What is wrong with it?
mysql> describe text;
+-----------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+------------------+------+-----+---------+----------------+
| old_id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| old_text | mediumblob | NO | | NULL | |
| old_flags | tinyblob | NO | | NULL | |
+-----------+------------------+------+-----+---------+----------------+
Upvotes: 0
Views: 224
Reputation: 23001
You shouldn't have BINARY
in that query. You should just need:
SELECT CONVERT(old_text USING utf8) from text
That's assuming the blob contains text encoded as utf_8.
Upvotes: 1