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 ...
随机推荐
- 实现JFileChooser的多种文件类型限制(设置过滤器)
使用时直接调用方法. // 多类型时使用 public void FileFilter(JFileChooser F) { String[][] fileNames = { { ".java ...
- node.js之forEach
forEach用法: var array1=[1,2,3]; array1.forEach(function(item,index){ console.log(item+'---'+index); } ...
- 三种ajax解析模式!
一.Ajax中的JSON格式 html代码: <html> <body> <input type="button" value="Ajax& ...
- 实用的随机数生成类Random:测试(随机产生100个不重复的正整数)
实用的随机数生成类Random:测试(使用Random类随机生成100个不重复的正整数) 一.之前我们使用随机数用的是Math类的random()方法: tips: 产生随机数(0~9中任意整数)的方 ...
- hdu 1520 树形DP基础
http://acm.hdu.edu.cn/showproblem.php?pid=1520 父节点和子节点不能同时选. http://blog.csdn.net/woshi250hua/articl ...
- PAT 1083 List Grades
#include <cstdio> #include <cstdlib> using namespace std; class Stu { public: ]; ]; }; i ...
- javascript实现数据结构与算法系列
1.线性表(Linear list) 线性表--简单示例及线性表的顺序表示和实现 线性表--线性链表(链式存储结构) 线性表的静态单链表存储结构 循环链表与双向链表 功能完整的线性链表 线性链表的例子 ...
- Java开发中代码规范有哪些?
Java开发中所要遵守的编码规范大体上有如下7点.命名规范.注释规范.缩进排版规范.文件名规范.声明规范.语句规范以及编程规范. 1.命名规范 (1)所有的标示符都只能用ASCⅡ字母(A-Z或a-z) ...
- Weka:call for the EM algorithm to achieve clustering.(EM算法)
EM算法: 在Eclipse中写出读取文件的代码然后调用EM算法计算输出结果: package EMAlg; import java.io.*; import weka.core.*; import ...
- SQL还原数据库后孤立用户问题处理(SQL 数据库 拥有对象 无法删除)
所谓孤立帐户,就是某个数据库的帐户只有用户名而没有登录名,这样的用户在用户库的sysusers系统表中存在,而在master数据库的syslogins中却没有对应的记录 孤立帐户的产生一般是一下两种: ...