Error Code: 1068. Multiple primary key defined

1、错误描述

10:10:38	alter table user add num int(8) primary key first	Error Code: 1068. Multiple primary key defined	0.000 sec

2、错误原因

这个错误的原因是定义了两个主键,导致出错

3、解决办法

alter table user add num int(8) primary key first;

去掉“primary key”

时间: 2024-10-10 09:04:37

Error Code: 1068. Multiple primary key defined的相关文章

MySQL中出现Multiple primary key defined报错提示之解决办法

创建主键可以有两种方式: create table 表名(字段名 类型,字段名 类型,--primary key(name)); 或者是 create table 表名(字段名 类型 primary key,字段名 类型,--); 但是要注意的是,想要创建复合主键,就不可以用第二种方式.下面列举一个小例子:这里报错Multiple primary key defined,表示定义了多个主键,正确的写法是如下:如果项设置复合主键,复合主键的特点是同时创建.同时删除,所以需要把主键删除,但是这里设置

ERROR 1105 (HY000): A PRIMARY KEY must include all columns in the table's partitioning function

ERROR 1105 (HY000): A PRIMARY KEY must include all columns in the table's partitioning function CREATE TABLE `sample` (  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',  `trade_no` varchar(32) NOT NULL COMMENT 'xxx',  `trade_type` varchar(32) D

Service Broker needs to access the master key in the database ‘BRM_TEST’. Error code:32. The master key has to exist and the service master key encryption is required.

Service Broker needs to access the master key in the database ‘BRM_TEST’. Error code:32. The master key has to exist and the service master key encryption is required. 日志错误:Service Broker needs to access the master key in the database 'BRM_TEST'. Err

Discuz升级 Database Error : pre_common_syscache ADD PRIMARY KEY (cname)【解决办法】

错误码: 1068Multiple primary key defined Execution Time : 00:00:00:000Transfer Time : 00:00:00:000Total Time : 00:00:00:000 解决办法:DROP TABLE IF EXISTS pre_common_syscache;CREATE TABLE pre_common_syscache ( cname varchar(32) NOT NULL, ctype tinyint(3) uns

MySQL Error Code文档手册---摘自MySQL官方网站

This chapter lists the errors that may appear when you call MySQL from any host language. The first list displays server error messages. The second list displays client program messages. Server error information comes from the following files: The Er

Create Primary Key using Entity Framework Code First

原文:http://www.codeproject.com/Articles/813912/Create-Primary-Key-using-Entity-Framework-Code-Fir Introduction This article describes the effect of Entity Framework Code First convention and configuration for creating Primary Key column. Entity Framew

Primary Key and Unique Key difference in SQL Server

posted from http://www.sqlservergeeks.com/primary-key-and-unique-key-difference-in-sql-server/ Primary and Unique Key both enforce uniqueness of columns on which they are defined. Then where do they differ? They differ in following way -          A p

socket error code

Error Codes The ERRNO values below are set when API calls fail. Use xn_getlasterror to retrieve the error code after an API call fails. Functionxn_geterror_string) can be used to retrieve the string name of a particular error code. All errno values a

MySQL主从复制中断,报“Error on master: message (format)='Cannot delete or update a parent row: a foreign key constraint fails' error code=1217” 错误

前几天,发现从库挂了,具体报错信息如下: 分析思路 1. 因为我采用的是选择性复制,只针对以下几个库进行复制: card,upay,deal,monitor,collect.所以,不太可能出现对于sas_basic的操作能复制到该从库上. 2. 整个架构是1主2从,且都是选择性复制,上面这个从库是直接复制card,upay,deal,monitor,collect这几个数据库的数据,而另外一个从库则是忽略上述库,如下所示: 怀疑是在上述schema下,执行了DROP TABLE IF EXIST