mysql字符类型长度限制
类别:数据库 浏览量:964
时间:2016-4-27 mysql字符类型长度限制
mysql字符类型长度限制一、CHAR
1、char (M)
2、长度是M*字符编码长度,M最大255
mysql> create table t1(name char(256)) default charset=utf8;
--ERROR 1074 (42000): Column length too big for column 'name' (max = 255); use BLOB or TEXT instead
mysql> create table t1(name char(255)) default charset=utf8;
--Query OK, 0 rows affected (0.06 sec)
二、VARCHAR
1、VARCHAR(M)
2、长度是M*字符编码长度
3、字符集是 utf8 时,最多只能指定21844的长度
mysql> create table t1(name varchar(65532)) default charset=utf8;
--ERROR 1074 (42000): Column length too big for column 'name' (max = 21845); use BLOB or TEXT instead
mysql> create table t1(name varchar(21845)) default charset=utf8;
--ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
mysql> create table t1(name varchar(21844)) default charset=utf8;
--Query OK, 0 rows affected (0.07 sec)
4、字符集是 latin1 时,最多只能指定65532的长度
mysql> create table t1(name varchar(65535));
--ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
mysql> create table t1(name varchar(65534));
--ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
mysql> create table t1(name varchar(65533));
--ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
mysql> create table t1(name varchar(65532));
--Query OK, 0 rows affected (0.08 sec)
标签:mysql
您可能感兴趣
- mysql数值类型图解(详解mysql持久化统计信息)
- mysql 操作日志(MySQL中的undo日志)
- mysql中date_format日期格式化
- mysql中null的用法(为什么mysql字段要使用NOT NULL)
- mysql所有用户命令(MySQL用户管理与PostgreSQL用户管理的区别说明)
- mysql的简单介绍(MySQL Shell的介绍以及安装)
- mysql能groupby两个字段吗(MySQL group by语句如何优化)
- mysql定时任务
- mysql主从复制如何解决延迟(MySQL 8.0.23中复制架构从节点自动故障转移的问题)
- mysql时间戳和datetime对比(MySQL时间设置注意事项的深入总结)
- mysql 索引举例(MySQL 各个索引的使用详解)
- MySQL中查询数据库的大小
- mysql子查询用法(MySQL 子查询和分组查询)
- mysql怎么使用null(MySQL null与not null和null与空值''''的区别详解)
- mysql8使用技巧(一篇学会MySQL 8.0 ROLE管理)
- mysql乐观锁与mvcc(MySQL中的乐观锁,悲观锁和MVCC全面解析)
- 泪目 这位 刷屏 的英雄,是全椒人的骄傲(泪目这位刷屏)
- 人从众 火炎焱 全椒再现 正月十六走太平 的魅力(人从众火炎焱全椒再现)
- 官宣 全椒籍明星许海峰 奚秀兰 方芳 王璐瑶携手回家 走太平(全椒籍明星许海峰)
- 以前全椒人是怎么过冬的 满满都是回忆(以前全椒人是怎么过冬的)
- NVIDIA显卡份额冲上88 A饭发愁 游戏优化恐没A卡份了(NVIDIA显卡份额冲上88A饭发愁)
- AMD YES A卡还是N卡 A卡和N卡的区别(AMDYESA卡还是N卡)
热门推荐
- dedecms注册怎么给权限(织梦DedeCms系统未审核文档禁止动态浏览修改方法view.php)
- css 最高层级(浅谈CSS 权值 层叠 重要性!important)
- 阿里云服务器怎么设置安全(详解阿里云服务器添加安全组规则图文教程)
- laravel队列使用场景(Laravel使用RabbitMQ的方法示例)
- python如何遍历列表并提取(Python同步遍历多个列表的示例)
- docker容器临时网络连接(Docker与iptables及实现bridge方式网络隔离与通信操作)
- iis7.5怎么安装(IIS7.5打开启用GZip压缩功能的设置教程方法)
- bootstrap怎么用虚线框(Bootstrap网页布局网格的实现)
- PC上的URL复制到手机浏览器打开
- dedecms如何写接口(dede的sql语句调用方法使用示例)
排行榜
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9