mysql:[Err] 1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key
删除主键时,出错:[Err] 1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key
alter table table_name drop primary key; # [Err] 1075
这是因为,建表时,该主键设置的是自增属性:即AUTO_INCREMENT
而自增列只能有1列,且这列必须为key,也就是建表的时候,如果是自增列,必须用primary key标识
例如该表中的 (id) 这一列:
create table if not exists table_name(
id INT UNSIGNED AUTO_INCREMENT,
name_people VARCHAR(40) NOT NULL,
submission_time DATETIME,
PRIMARY KEY(id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
解决方法:
建表时,不要加入自增属性,之后就可以删除主键,例如:
create table if not exists table_name_2(
id INT UNSIGNED,
name_people VARCHAR(40) NOT NULL,
submission_time DATETIME,
PRIMARY KEY(id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
然后可以删除主键:
alter table table_name_2 drop primary key;
# 欢迎交流
mysql:[Err] 1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key的更多相关文章
- 解决,Incorrect table definition; there can be only one auto column and it must be defined as a key
今天在迁移项目时,操作数据库报错: Incorrect table definition; there can be only one auto column and it must be defin ...
- ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key
约束字段为自动增长,被约束的字段必须同时被key约束 没有设置成primary key 时,会报错. 加上primary key 则设置成功.
- Mysql运行SQL文件 错误Incorrect table definition;there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
问题描述 想从服务器上DOWN下数据库.操作:先把数据库转存为SQL文件,然后在本地利用navicate运行SQL文件,出现错误信息: Incorrect table definition;there ...
- msyql同步的时候报错 : 错误代码: 1293 Incorrect table definition;there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
场景,两个不同服务器上的数据库,进行数据库同步 但是执行之后,提示报错 错误代码: 1293 Incorrect table definition; there can be only one TIM ...
- 1293 - Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
在数据库执行脚本文件时,执行到一半会遇到 这种问题: 出错处:2018-05-14 18:53:38 行号:712454 错误代码: 1293 - Incorrect table definitio ...
- Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
错误描述 在DBeaver执行DDL语句时报错:SQL 错误 [1293] [HY000]: Incorrect table definition; there can be only one TIM ...
- mysql单表多timestamp报错#1293 - Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
一个表中出现多个timestamp并设置其中一个为current_timestamp的时候经常会遇到#1293 - Incorrect table definition; there can be o ...
- Mysql --- Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
我使用的5.5的mysql数据库会报这个错, 换成5.7的就可以了
- MySQL:Error : Tablespace for table '`database`.`temp`' exists. Please DISCARD the tablespace before IMPORT.解决办法
今天在navicat上操作mysql数据库表,突然没有响应了.随后重启,mysql服务也终止了.随后启动服务,检查表,发现一张表卡没了,就重新添加一张表.报了一个错: Error : Tablespa ...
随机推荐
- css3逐帧动画
写css3动画的时候,我们经常用到animation来实现,默认情况下,animation是属于连贯性的ease动画.我们熟悉的animation动画有ease.ease-in.ease-out.li ...
- [LeetCode] 259. 3Sum Smaller 三数之和较小值
Given an array of n integers nums and a target, find the number of index triplets i, j, k with 0 < ...
- java的字节码bytecode
字节码名字的由来 字节码以一个字节即8bit为最小单位储存:字节码是java程序编译后的结果:字节码是一组8位字节为基础单位的二进制流 Java从源文件到执行的过程. 如何阅读JAVA字节码
- kexue shangwang
根据实践,pptp.IPsec甚至OpenVPN等kexue上网法已经无法顺利翻越GFW.通过抓包可知,GFW会将pptp的握手期间的ack包吞掉,导致本地一直无法收到服务器端的响应.而OpenVPN ...
- ObjectARX创建带文字的线型实例代码
AcDbLinetypeTable* pLinetypeTable=NULL; Acad::ErrorStatus es = acdbHostApplicationServices()->wor ...
- .Net - 线程本地变量(存储)的使用
关于C#多线程的文章,大部分都在讨论线程的开始与停止或者是多线程同步问题.多线程同步就是在不同线程中访问同一个变量或共享资源,众所周知在不使用线程同步的机制下,由于竞争的存在会使某些线程产生脏读或者是 ...
- Oracle Spatial分区应用研究之三:县市省不同分区粒度的效率比较
在<Oracle Spatial分区应用研究之一:分区与分表查询性能对比>中已经说明:按县分区+全局空间索引效率要优于按县分区+本地空间索引,因此在该实验报告中,将不再考虑按县分区+本地空 ...
- GridView树状结构显示
下面的树形结构代码需要GridVIew中的数据要求是按照上下级关系已经排列好的顺序,比如: GridView ID ParentID Name 1 0 父1 2 1 父1子1 3 1 父1子2 4 3 ...
- PHP设计模式 - 建造者模式
建造者模式主要在于创建一些复杂的对象.将一个复杂对象的构造与它的表示分离,使同样的构建过程可以创建不同的表示的设计模式; 结构图: <?php /** * * 产品本身 */ class Pro ...
- Django content-type组件
介绍 Django包含一个contenttypes应用程序(app),可以跟踪Django项目中安装的所有模型(Model),提供用于处理模型的高级通用接口. Contenttypes应用的核心是Co ...