开发者

A ideal data type for long utf8 strings in mysql

开发者 https://www.devze.com 2023-01-09 15:36 出处:网络
Is it true that VARCHAR type in mysql only suppory 255 characters data length? if it is开发者_开发问答 true what kind of datatype for UTF8 strings is useful for long texts? I\'m using utf8_persian_ci

Is it true that VARCHAR type in mysql only suppory 255 characters data length? if it is开发者_开发问答 true what kind of datatype for UTF8 strings is useful for long texts? I'm using utf8_persian_ci datatype.

Note that TEXT datatype have problem with utf8_persian_ci.


Is it true that VARCHAR type in mysql only suppory 255 characters data length?

Not since MySQL 5.0.3, according to the documentation:

The length can be specified as a value from 0 to 255 before MySQL 5.0.3, and 0 to 65,535 in 5.0.3 and later versions.


The max length of a VARCHAR in all current versions of MySQL is 65535.

In old releases of MySQL, VARCHAR had a max length of 255, but that's ancient history (where ancient is prior to March 2005).

The CHAR data type still has a limit of 255 characters.


When I need to store large amounts of text, I go for a TEXT field with the utf8_general_ci collation. To be honest, I am not sure what the difference between the different uft8 encodings are, but if you need to store longer texts, go for one of the TEXT types.


you may use "utf8_general_ci collation" I think this will help you, but m not sure

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号