What is maximum length for MySQL TEXT field type?
Last Modified at 2020-03-22 17:14:29
If you are wondering about MySQL TEXT
field size limit and what types of TEXT
fields are available then this tutorial is for you. TEXT
datatype are stored outside of the table and just having a pointer to the location of the actual storage. TEXT
datatype could store much more information than VARCHAR
datatypes. This field type is used to when you need to store messages, emails, comments, formatted text and html code etc.
Now, we will talk about the size limit of TEXT
datatype and what types of TEXT
fields are available. There are four types of TEXT available in MySQL.
- TINYTEXT: TINYTEXT is a string datatype that can store up to 256 bytes (255 characters)
- TEXT: TEXT is a string datatype and can store up to 64 kilobytes (65,535 characters).
- MEDIUMTEXT: MEDIUMTEXT is also a string datatype and the maximum length is 16 megabytes (16,777,215 characters).
- LONGTEXT: LONGTEXT is a string datatype with the maximum length of 4 gigabytes (4,294,967,295 characters).
If you are creating a blog or a website that require storing large block of texts, formatted code etc then MEDIUMTEXT or LOGTEXT would be a better option.
Please write in the comment section below, if you need more information or any questions.