Vigneshwaran
Vigneshwaran

Reputation: 3275

Is it safe to convert the charset of a TEXT column from utf8 to utf8mb4 in mysql?

I am trying to convert the charset of a TEXT column in a huge production database from utf8 to utf8mb4 to support emojis.

I have read that for varchar columns we need to calculate and provide a different size in the alter command. But I couldn't find anything about TEXT columns.

TEXT columns are stored off the table so can I go ahead with the alter command or is there anything to be considered?

Upvotes: 1

Views: 730

Answers (1)

Rick James
Rick James

Reputation: 142298

Not a problem.

The "different size" may refer to changing VARCHAR(255) to VARCHAR(191) to fit within the 767 byte limit for indexes. That is not relevant for TEXT.

How ere you planning on doing the conversion? I think (but have not tested) this will work:

ALTER TABLE tbl CONVERT TO CHARACTER SET utf8mb4;

Upvotes: 1

Related Questions