DELIMITER $$
CREATE FUNCTION BLOB2TXT (blobfield VARCHAR(255)) RETURNS longtext
DETERMINISTIC
NO SQL
BEGIN
RETURN CAST(blobfield AS CHAR(10000) CHARACTER SET utf8);
END
$$
DELIMITER ;
ALTER TABLE mytable
ADD COLUMN field1_new TEXT NOT NULL,
ADD COLUMN field2_new TEXT NOT NULL;
update mytable set
field1_new = CONVERT(field1 USING utf8),
field2_new = CONVERT(field2 USING utf8);
alter table mytable
drop column field1,
drop column field2;
alter table mytable
change column field1_new field1 text,
change column field2_new field2 text;
SELECT
blobfield,
CONVERT(blobfield USING utf16),
CONVERT(CONVERT(blobfield USING utf16), BINARY),
CAST(blobfield AS CHAR(10000) CHARACTER SET utf16),
CAST(CAST(blobfield AS CHAR(10000) CHARACTER SET utf16) AS BINARY)