Navicat for Mysql中错误提示索引过长1071-max key length is 767 byte
1.建用户信息表 tb_person_info
create table tb_person_info(
user_id int(10) auto_increment,
`name` varchar(32) default null,
gender varchar(2) default null,
profile_img varchar(1024) default null,
email varchar(1024) default null,
enable_status int(2) not null default 0 comment '0:禁止访问商城,1:允许访问商城',
user_type int(2) not null default 1 comment '1:顾客,2:商家,3:超级管理员',
create_time datetime default null,
last_edit_time datetime default null,
primary key(user_id)
);
2.建微信账号表 tb_wechat_auth
create table tb_wechat_auth(
2 wechat_auth_id int(10) auto_increment,
user_id int(10) not null,
4 open_id varchar(1024) not null,
create_time datetime default null,
6 primary key(wechat_auth_id),
7 constraint fk_wechatauth_profile foreign key(user_id)
8 references tb_person_info(user_id),
9 unique key(open_id)
);
出现错误提示:[Err] 1071 - Specified key was too long; max key length is 767 bytes
错误地方:
open_id varchar(1024) not null
create table tb_wechat_auth(
wechat_auth_id int(10) auto_increment,
user_id int(10) not null,
4 open_id varchar(256) not null,
create_time datetime default null,
primary key(wechat_auth_id),
constraint fk_wechatauth_profile foreign key(user_id)
references tb_person_info(user_id),
9 unique key(open_id)
);
仍然报错:[Err] 1071 - Specified key was too long; max key length is 767 bytes
create table tb_wechat_auth(
wechat_auth_id int(10) auto_increment,
user_id int(10) not null,
4 open_id varchar(255) not null,
create_time datetime default null,
primary key(wechat_auth_id),
constraint fk_wechatauth_profile foreign key(user_id)
references tb_person_info(user_id),
9 unique key(open_id)
);
原因分析正确,建表成功!展示如下
1.栏位
2.索引
3.外键
总结:varchar(n),n≤255
Navicat for Mysql中错误提示索引过长1071-max key length is 767 byte的更多相关文章
- EF MySQL 提示 Specified key was too long; max key length is 767 bytes错误
在用EF的CodeFirst操作MySql时,提示 Specified key was too long; max key length is 767 bytes错误,但数据库和表也建成功了.有高人知 ...
- Hive集成Mysql作为元数据时,提示错误:Specified key was too long; max key length is 767 bytes
在进行Hive集成Mysql作为元数据过程中.做全然部安装配置工作后.进入到hive模式,运行show databases.运行正常,接着运行show tables:时却报错. 关键错误信息例如以下: ...
- mysql 索引过长1071-max key length is 767 byte
问题 create table: Specified key was too long; max key length is 767 bytes 原因 数据库表采用utf8编码,其中varchar ...
- 【转】mysql 索引过长1071-max key length is 767 byte
问题 create table: Specified key was too long; max key length is 767 bytes 原因 数据库表采用utf8编码,其中varchar(2 ...
- 数据库操作提示:Specified key was too long; max key length is 767 bytes
操作重现: 法1:新建连接——>新建数据库——>右键数据库导入脚本——>提示:Specified key was too long; max key length is 767 by ...
- 索引长度过长 ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes
1.发现问题 今天在修改innodb表的某个列的长度时,报如下错误: alter table test2 modify column id varchar(500); ERROR 1071 (4200 ...
- Specified key was too long; max key length is 767 bytes mysql
Specified key was too long; max key length is 767 bytes 说明: 执行当前 Web 请求期间,出现未经处理的异常.请检查堆栈跟踪信息,以了解有关该 ...
- hive mysql元数据,报错 Specified key was too long; max key length is 767 bytes
Specified key was too long; max key length is 767 bytes 此错误为hive 元数据mysql 字符集编码问题 如 show create tabl ...
- 关于MySQL字符集问题:Specified key was too long; max key length is 767 bytes
[文章来源]http://blog.csdn.net/cindy9902/article/details/6215769 MySQL: ERROR 1071 (42000): Specified ke ...
随机推荐
- JUnit测试框架的使用
1.学习Junit框架的使用 可通过以下两个示例进行学习. A.Junit使用方法示例1 1)把Junit引入当前项目库中 新建一个 Java 工程—coolJUnit,打开项目coolJUnit 的 ...
- 自己用jquery+css+div写的一个弹窗
弹窗支持两种模式,一种是普通信息提示框,调用方法:popup.msgPopup(msg); 另一种是可以加载页面的弹窗,调用方法:popup.pagePopup(url); 效果图: css代码 ;; ...
- FileUpload一键自动上传
背景 源程序二次修改 传统的Asp.net WebForm开发 上传控件样式可自定义 分析 不能用第三方插件,因为源程序开发模式对异步的支持不友好而第三方插件大都是针对异步编程的 兼容IE8及以上和其 ...
- DataRow获取数值类型为空或NULL时异常处理
//获取数据集内容 DataSet ContractDS = dal.GetJHFKStr(jhfubh); //验证数据集是否为空 if (!DataSetUtil.IsNullOrEmpty(Co ...
- python-requests 简单实现数据抓取
安装包: requests,lxmlrequest包用于进行数据抓取,lxml用来进行数据解析对于对网页内容的处理,由于html本身并非如数据库一样为结构化的查询所见即所得,所以需要对网页的内容进行分 ...
- python的返回值
1.返回值的作用 函数并非总是直接显示输出,相反,它可以处理一些数据,并返回一个或一组值.函数返回的值被称为返回值.在函数中,可使用return语句将值返回到调用函数的代码行.返回值让你能够将程序的大 ...
- NIOSocket Server Client
最近在看Netty框架,顺便写了一下NIO SocketChannel服务端和客户端 Server.java import java.io.IOException; import java.net.I ...
- Spring MVC 参数必填项导致客户端报 HTTP 400 并且无法进入断点的问题
1.问题 Spring MVC 在参数上设置了必填项,post 请求时报 HTTP 400 并且未进入断点,如将“年龄”设置为了必填项: @RequestParam( value="age& ...
- 18_CGLib动态代理
[概述] 已知JDK动态代理中的Proxy.newProxyInstance(ClassLoader loader,Class[] interfaces,InvocationHandler h)方法的 ...
- 删除排序数组中的重复数字 - C++
class Solution { public: /** * @param A: a list of integers * @return : return an integer */ int rem ...