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 ...
随机推荐
- 顶部导航TabBar、TabBarView、DefaultTabController
原文地址:https://www.cnblogs.com/upwgh/p/11369537.html TabBar:Tab页的选项组件,默认为水平排列. TabBarView:Tab页的内容容器,Ta ...
- MD5(3)
import java.io.UnsupportedEncodingException; import java.security.PrivateKey; import java.security.S ...
- node 单例
ScriptManager.getInstance = function () { if (_instance != null) { return _instance; } else { return ...
- 编写max(list) 返回列表最大元素
defmodule MyList do def max(list), do: _max(list, 0) defp _max([], max), do: max defp _max([head | t ...
- 【电商日志项目之六】数据分析-Hive方式
环境 hadoop-2.6.5 hive-1.2.1 一.Hive和Hbase整合如果使用Hive进行分析,Hive要从Hbase取数据(当然可以直接将数据存到Hive),那么就需要将Hive和HBa ...
- 论consul正确的关闭姿势
最近在工作中发现一个有意思的现象,我用 ctrl+c 关闭本地 consul 的时候,报警系统并没有发出告警,说我的 node 异常,自己看了一下代码,发现 consul 的关闭还是有点猫腻的,仔细来 ...
- 最新 学霸君java校招面经 (含整理过的面试题大全)
从6月到10月,经过4个月努力和坚持,自己有幸拿到了网易雷火.京东.去哪儿.学霸君等10家互联网公司的校招Offer,因为某些自身原因最终选择了学霸君.6.7月主要是做系统复习.项目复盘.LeetCo ...
- LeetCode 151. 翻转字符串里的单词(Reverse Words in a String)
151. 翻转字符串里的单词 151. Reverse Words in a String
- Django组件之auth
一.什么是Auth模块 Auth模块是Django自带的用户认证模块,默认使用 auth_user 表来存储用户数据. 二.使用方法 1.创建超级用户 python3 manage.py create ...
- 爬虫请求库之requests库
一.介绍 介绍:使用requests可以模拟浏览器的请求,比之前的urllib库使用更加方便 注意:requests库发送请求将网页内容下载下来之后,并不会执行js代码,这需要我们自己分析目标站点然后 ...