Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

SQL query:

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

1075 - Incorrect table definition; 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

like image 312
Nimara Avatar asked Dec 01 '13 09:12

Nimara


People also ask

What phpMyAdmin used for?

phpMyAdmin is a free software tool written in PHP that is intended to handle the administration of a MySQL or MariaDB database server. You can use phpMyAdmin to perform most administration tasks, including creating a database, running queries, and adding user accounts.

Is phpMyAdmin and MySQL same?

MySQL is a RDBMS (Relational DataBase Management System), PhpMyAdmin is a web application wich let you manage (with a visual interface) MySQL Databases.

Is phpMyAdmin still used?

We have data on 5,073 companies that use phpMyAdmin. The companies using phpMyAdmin are most often found in United States and in the Information Technology and Services industry. phpMyAdmin is most often used by companies with 10-50 employees and 1M-10M dollars in revenue.

How do I access phpMyAdmin localhost?

Once phpMyAdmin is installed point your browser to http://localhost/phpmyadmin to start using it. You should be able to login using any users you've setup in MySQL. If no users have been setup, use admin with no password to login.

What is phpMyAdmin and how to use it?

phpMyAdmin is a free software tool written in PHP, intended to handle the administration of MySQL over the Web. phpMyAdmin supports a wide range of operations on MySQL and MariaDB. Frequently used operations (managing

How do I login to localhost phpMyAdmin?

open http://localhost/phpmyadmin/ . http://localhost/phpmyadmin is a part of localhost database administration software (phpmyadmin) url login address. You can enter the address from http://localhost/phpmyadmin or you can use the following terminal input tool (web-based viewer).

What is the IP address for access phpMyAdmin?

Access phpMyAdminon port 8889:http://localhost:8889/phpmyadmin Your IP Address 207.46.13.127 This IP address is not the IP address used by your computer to communicate with other machines on your network. Change IP Address? Access possible folders or projects

Which softwares are required to install before phpMyAdmin?

With the Apache Server: In this process, the Apache server, the PHP, and the MySQL database are the softwares that are required to be installed beforehand, that is, before installing the actual phpMyAdmin tool to the same system.


3 Answers

A bit late, but i'm getting the same error in the latest version of phpMyAdmin (4.4.2). Nimara used manual SQL query, i used the special "add new table" form and still got this error.

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. It seems that when you add more columns, phpMyAdmin does some kind of background refresh and loses the "primary" information. You still see it in your form, but in the background the SQL query it sends does not have this info any more.

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.

like image 175
AdrianC Avatar answered Oct 18 '22 21:10

AdrianC


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;
like image 37
Tarun Avatar answered Oct 18 '22 20:10

Tarun


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.

like image 6
juergen d Avatar answered Oct 18 '22 20:10

juergen d