mysql的text字段长度?mysql数据库中text字段长度不够的问题
2014-02-21 09:09
417 查看
类型是可变长度的字符串,最多65535个字符;
可以把字段类型改成MEDIUMTEXT(最多存放16777215个字符)或者LONGTEXT(最多存放4294967295个字符).
MySQL supports 4 TEXT field types (TINYTEXT, TEXT, MEDIUMTEXT and LONGTEXT) and this post looks at the maximum length of each of these field types.
MyISAM tables in MySQL have a maximum size of a row of 65,535 bytes, so all the data in a row must fit within that limit. However, the TEXT types are stored outside the table itself and only contribute 9 to 12 bytes towards that limit. (For more information about this refer to the MySQL Manual - Data Storage Requirements chapter). TEXT data types are also able to store much more data than VARCHAR and CHAR text types so TEXT types are what you need to use when storing web page or similar content in a database. The maximum amount of data that can be stored in each data type is as follows: TINYTEXT 256 bytes
TEXT 65,535 bytes ~64kb
MEDIUMTEXT 16,777,215 bytes ~16MB
LONGTEXT 4,294,967,295 bytes ~4GB
In most circumstances the TEXT type is probably sufficient, but if you are coding a content management system it's probably best to use the MEDIUMTEXT type for longer pages to ensure there are no issues with data size limits.
可以把字段类型改成MEDIUMTEXT(最多存放16777215个字符)或者LONGTEXT(最多存放4294967295个字符).
MySQL supports 4 TEXT field types (TINYTEXT, TEXT, MEDIUMTEXT and LONGTEXT) and this post looks at the maximum length of each of these field types.
MyISAM tables in MySQL have a maximum size of a row of 65,535 bytes, so all the data in a row must fit within that limit. However, the TEXT types are stored outside the table itself and only contribute 9 to 12 bytes towards that limit. (For more information about this refer to the MySQL Manual - Data Storage Requirements chapter). TEXT data types are also able to store much more data than VARCHAR and CHAR text types so TEXT types are what you need to use when storing web page or similar content in a database. The maximum amount of data that can be stored in each data type is as follows: TINYTEXT 256 bytes
TEXT 65,535 bytes ~64kb
MEDIUMTEXT 16,777,215 bytes ~16MB
LONGTEXT 4,294,967,295 bytes ~4GB
In most circumstances the TEXT type is probably sufficient, but if you are coding a content management system it's probably best to use the MEDIUMTEXT type for longer pages to ensure there are no issues with data size limits.
相关文章推荐
- mysql的text字段长度?mysql数据库中text字段长度不够的问题
- mysql的text字段长度?mysql数据库中text字段长度不够的问题
- oracle迁移到mysql时insert数据到mysql text字段发现报字段不够长的问题
- mysql的text字段长度
- mysql中int()字段类型长度 问题解释
- MySQL 建表字段长度的限制问题
- mysql字段长度的问题
- 创建mysql数据表时,字段的int类型长度问题
- MySql关于修改字段名/长度相关问题(不定时更新)
- mysql的text类型长度问题
- 关于mysql数据库text等相关字段长度信息
- wpf读取mysql字段类型为text的问题
- 数据库的索引,mysql中的索引|||如何在mysql中对text字段加索引?|||mysql数据库中的字段在什么情况下加索引?|||高手请进:text字段不能做索引,有无其他方法?|||该建那个字段
- 关于MYSQL字段长度设置的问题
- MySQL 建表字段长度的限制问题
- mysql 的text字段无法取值问题
- [MySQL]load data local infile向MySQL数据库中导入数据时,无法导入和字段不分离问题。
- 关于mysql的字段长度含义问题。
- MySql字段定义长度字节和字符问题
- MySQL 修改字段类型或长度