简体   繁体   English

Phpmyadmin#1075-错误的表定义; 只能有一个自动列,并且必须将其定义为键

[英]Phpmyadmin #1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key

Hi, I'm importing mySql database (which was originally an access database) into phpmyadmin and its giving me this error: 嗨,我正在将mySql数据库(最初是一个访问数据库)导入phpmyadmin,并给了我这个错误:

SQL query: SQL查询:

CREATE TABLE  `Acc_inst` (

 `inst_ID` INTEGER NOT NULL AUTO_INCREMENT ,
 `inst_Name` VARCHAR( 255 ) ,
 `Inst_Ws` VARCHAR( 255 ) ,
 `inst_ph` VARCHAR( 255 ) ,
 `inst_Fx` VARCHAR( 255 ) ,
 `Inst_E` VARCHAR( 255 )
) ENGINE = INNODB DEFAULT CHARSET = utf8;

MySQL said: Documentation MySQL说:文档

1075 - Incorrect table definition; 1075-错误的表格定义; there can be only one auto column and it must be defined as a key 只能有一个自动列,并且必须将其定义为键

-- There is in fact only on auto increment column and it is defined as a primary key so I dont get why its giving me this error - 实际上仅在自动增量列上,它被定义为主键,所以我不明白为什么它会给我这个错误

A bit late, but i'm getting the same error in the latest version of phpMyAdmin (4.4.2). 有点晚了,但是我在最新版本的phpMyAdmin(4.4.2)中遇到了同样的错误。 Nimara used manual SQL query, i used the special "add new table" form and still got this error. Nimara使用了手动SQL查询,我使用了特殊的“添加新表”形式,但仍然出现此错误。

So, for those of you that got here just like me, searching the #1075 error, you should know that this happens if you set your index / primary / autoincrement column in the form at first, then added some new columns and then wanted to submit the form. 因此,对于像我这样来到这里的人,搜索#1075错误,您应该知道,如果首先在表单中设置index / primary / autoincrement列,然后添加一些新列,然后想要提交表格。 It seems that when you add more columns, phpMyAdmin does some kind of background refresh and loses the "primary" information. 看来,当您添加更多列时,phpMyAdmin会进行某种类型的后台刷新,并且会丢失“主要”信息。 You still see it in your form, but in the background the SQL query it sends does not have this info any more. 您仍然可以在窗体中看到它,但是在后台发送的SQL查询不再有此信息。

So the solution would be to deselect your primary column and set it again. 因此,解决方案是取消选择您的主列,然后再次进行设置。 I'm pretty sure it's a bug, but it solves simple and fast this way. 我敢肯定这是一个错误,但可以通过这种方式快速简便地解决。

Define your auto increment column as a primary key. 将自动增量列定义为主键。

CREATE TABLE  `Acc_inst` 
(    
   `inst_ID` INTEGER NOT NULL AUTO_INCREMENT ,
   `inst_Name` VARCHAR( 255 ) ,
   `Inst_Ws` VARCHAR( 255 ) ,
   `inst_ph` VARCHAR( 255 ) ,
   `inst_Fx` VARCHAR( 255 ) ,
   `Inst_E` VARCHAR( 255 ) ,
   PRIMARY KEY `inst_ID`(`inst_ID`)
) ENGINE = INNODB DEFAULT CHARSET = utf8;
CREATE TABLE  `Acc_inst` 
(    
   `inst_ID` INTEGER NOT NULL primary key AUTO_INCREMENT ,
   `inst_Name` VARCHAR( 255 ) ,
   `Inst_Ws` VARCHAR( 255 ) ,
   `inst_ph` VARCHAR( 255 ) ,
   `inst_Fx` VARCHAR( 255 ) ,
   `Inst_E` VARCHAR( 255 )
) ENGINE = INNODB DEFAULT CHARSET = utf8;

The error says you must define an auto increment column as key: Add primary key to this column definition. 该错误表明您必须将自动增量列定义为键:将primary key添加到此列定义中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 #1075-错误的表格定义; 只能有一个自动列,并且必须将其定义为键 - #1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key Laravel 1075 表定义不正确; 只能有一个自动列,并且必须将其定义为键 - Laravel 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key SQLSTATE[42000]:语法错误或访问冲突:1075 不正确的表定义; 只能有一个自动列,并且必须将其定义为键 - SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key Laravel 1075 表定义不正确; 只能有一个自动列,并且不能将其定义为键 - Laravel 1075 Incorrect table definition; there can be only one auto column and it mus t be defined as a key 表定义不正确; 只能有一个自动列,必须将其定义为键Codeigniter - Incorrect table definition; there can be only one auto column and it must be defined as a key Codeigniter MySQL错误:错误的表格定义; 只能有一个自动列,并且必须将其定义为键 - MySQL error: Incorrect table definition; there can be only one auto column and it must be defined as a key Laravel 表:只能有一个自动列,并且必须定义为键 - Laravel table: 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 SQLSTATE [42000]:只能有一个自动列,必须将其定义为键 - SQLSTATE[42000]: There can be only one auto column and it must be defined as a key 迁移问题:只有一个自动列,必须将其定义为键 - Migration issue : Only one auto column and it must be defined as a key
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM