Ошибка 1075 phpmyadmin

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

Brett Schneider's user avatar

asked Dec 1, 2013 at 9:17

Nimara's user avatar

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.

answered Apr 16, 2015 at 21:12

AdrianC's user avatar

AdrianCAdrianC

1411 silver badge2 bronze badges

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;

answered Dec 1, 2013 at 9:22

Tarun's user avatar

TarunTarun

3,1623 gold badges29 silver badges45 bronze badges

0

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.

answered Dec 1, 2013 at 9:18

juergen d's user avatar

juergen djuergen d

202k37 gold badges293 silver badges362 bronze badges

This error occur in latest version so, just refresh page(ctrl+f5) and create table again.

answered Aug 26 at 8:59

Adeel Empire's user avatar

2

I’m importing a MySql database into phpmyadmin and it’s giving me this error:

1075 — Incorrect table definition; there can be only one auto column and it must be defined as a key

SQL Query:

CREATE TABLE `global_config` (
  `id` int(10) primary key NOT NULL AUTO_INCREMENT,
  `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `sitename` varchar(1024) COLLATE utf8_unicode_ci NOT NULL,
  `siteurl` varchar(1024) COLLATE utf8_unicode_ci NOT NULL,
  `admin_email` varchar(1024) COLLATE utf8_unicode_ci DEFAULT '',
  `mail_from` varchar(1024) COLLATE utf8_unicode_ci DEFAULT '',
  `smtp_from` varchar(1024) COLLATE utf8_unicode_ci DEFAULT '',
  `smtp_pass` varchar(1024) COLLATE utf8_unicode_ci DEFAULT '',
  `app_enabled` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `paypal_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `paypal_sandbox` varchar(1024) COLLATE utf8_unicode_ci NOT NULL,
  `meta_description` varchar(1024) COLLATE utf8_unicode_ci NOT NULL,
  `meta_keywords` varchar(1024) COLLATE utf8_unicode_ci DEFAULT '',
  `fb_profile_upload` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `fb_page_upload` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `twitter_upload` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `instagram_upload` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pinterest_upload` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `youtube_upload` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `global_message` varchar(1024) COLLATE utf8_unicode_ci DEFAULT '',
  `referer_prize` varchar(1024) COLLATE utf8_unicode_ci DEFAULT '',
  `fb_verified_likes` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `tw_verified_followers` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `in_verified_followers` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pin_verified_followers` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `yt_verified_subscribers` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `yt_verified_views` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `min_payout_amount` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `per_ads_payout` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `credit_system` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `enable_cash_payout` int(10) unsigned NOT NULL AUTO_INCREMENT
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

Вы не вошли. Пожалуйста, войдите или зарегистрируйтесь.

Активные темы Темы без ответов

Ошибка MySQL при переносе таблицы: #1075 — Incorrect table definition

Страницы 1

Чтобы отправить ответ, вы должны войти или зарегистрироваться

1 2006-09-30 20:21:15

  • duremar
  • Редкий гость
  • Неактивен
  • Зарегистрирован: 2006-09-29
  • Сообщений: 5

Тема: Ошибка MySQL при переносе таблицы: #1075 — Incorrect table definition

Переношу сайт себе на локальный компьютер, программил не я. При переносе одной из таблиц появляется ошибка — #1075 — Incorrect table definition; There can only be one auto column and it must be defined as a key

Нифига не понимаю в базах, но перести очень надо. Объясните, что не так. Насколько понял причина в этом:

CREATE TABLE `md_content` (
`ID` INT( 11 ) NOT NULL AUTO_INCREMENT ,
`Parent` INT( 11 ) NOT NULL DEFAULT ‘0’,
`Level` INT( 11 ) NOT NULL DEFAULT ‘0’,
`Name` VARCHAR( 50 ) NOT NULL ,
……………..
…………….
……………
`Work` CHAR( 3 ) NOT NULL DEFAULT ‘000’,
……………
……………
…………..

Вроде как проблема именно в строке Work. Что именно не нравится?

2 Ответ от Lokki 2006-10-01 05:37:14

  • Lokki
  • Lokki
  • Админ
  • Неактивен
  • Откуда: Москва
  • Зарегистрирован: 2006-01-25
  • Сообщений: 910

Re: Ошибка MySQL при переносе таблицы: #1075 — Incorrect table definition

duremar
Правила читаем, в особенности путкт 5 (Называние топику следует давать такое, чтобы оно соответствовало теме  и отражало её суть) и больше их не нарушаем.

При переносе одной из таблиц появляется ошибка — #1075 — Incorrect table definition; There can only be one auto column and it must be defined as a key

MySQL-сервер сигналит тебе, что в таблице может быть только одно поле с атрибутом AUTO_INCREMENT, которое должно быть индексом. Например так:

CREATE TABLE `md_content` (
`ID` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
`Parent` INT( 11 ) NOT NULL DEFAULT '0',
`Level` INT( 11 ) NOT NULL DEFAULT '0',
`Name` VARCHAR( 50 ) NOT NULL ,
.................
................
...............
`Work` CHAR( 3 ) NOT NULL DEFAULT '000',
PRIMARY KEY  (`ID`)
);

Обрати внимание на следующие строки, которые в твоем случае являются ключевыми:
`ID` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
PRIMARY KEY  (`ID`)

Нет неразрешимых проблем, есть неприятные решения. (Э. Борн)

Сообщения 2

Страницы 1

Чтобы отправить ответ, вы должны войти или зарегистрироваться

Tags:

sql

php

mysql

phpmyadmin

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


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


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 19 ’22 03: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



MySQL is a popular open-source relational database management system used by developers to store and manage data. It is known for its excellent performance, scalability, and reliability. However, it is not without its quirks and issues. One of the most common errors that MySQL users encounter is the «Incorrect table definition; there can be only one auto column and it must be defined as a key» error. This error message can be frustrating, but fortunately, there is a straightforward solution that we’ll discuss in this guide.

What Causes the «Incorrect Table Definition» Error?

The «Incorrect table definition; there can be only one auto column and it must be defined as a key» error occurs when you try to create a table in MySQL with more than one column set to auto-increment. MySQL requires that there be only one auto-increment column per table, and that column must be defined as a key. If you try to create a table with more than one auto-increment column or forget to define the auto-increment column as a key, you’ll see this error message.

How to Fix the «Incorrect Table Definition» Error

To fix the «Incorrect table definition» error, you need to ensure that you have only one auto-increment column per table and that column is defined as a key. Follow these steps to fix the error:

Identify the table causing the error: The first step is to identify the table that is causing the error. Look for the table name in the error message, which should be something like «Error Code: 1075. Incorrect table definition; there can be only one auto column and it must be defined as a key.»

Remove the auto-increment attribute from the non-key column(s): Once you’ve identified the table causing the error, remove the auto-increment attribute from any column(s) that are not keys. You can do this by modifying the table definition using the ALTER TABLE statement. For example, if your table has columns named id and name, and you want id to be the auto-increment key, run the following command:

ALTER TABLE table_name MODIFY COLUMN name data_type;

Replace table_name with the name of your table, name with the name of the non-key column you want to remove the auto-increment attribute from, and data_type with the data type of the column.

Define the auto-increment column as a key: The last step is to define the auto-increment column as a key. You can do this by modifying the table definition using the ALTER TABLE statement. For example, if your table has a column named id that you want to define as the auto-increment key, run the following command:

ALTER TABLE table_name MODIFY COLUMN id INT AUTO_INCREMENT PRIMARY KEY;

Replace table_name with the name of your table and id with the name of the auto-increment column.

After following these steps, you should be able to create the table without encountering the «Incorrect table definition» error.

FAQ

Q1. Can I have multiple auto-increment columns in a MySQL table?

No, you can only have one auto-increment column per table in MySQL.

Q2. What data types can I use for the auto-increment column in MySQL?

You can use the following data types for the auto-increment column in MySQL: TINYINT, SMALLINT, MEDIUMINT, INT, BIGINT.

Q3. Can I change the auto-increment value in MySQL?

Yes, you can change the auto-increment value in MySQL using the ALTER TABLE statement. For example, if you want to set the auto-increment value to 100, run the following command:

ALTER TABLE table_name AUTO_INCREMENT = 100;

Replace table_name with the name of your table and 100 with the value you want to set.

Q4. What is a primary key in MySQL?

A primary key is a column or a set of columns in a table that uniquely identifies each row. It is used for indexing and to ensure data integrity.

Q5. What are some common MySQL errors?

Some common MySQL errors include syntax errors, connection errors, and permission errors. Other common errors include the «Table ‘table_name’ already exists» error and the «Unknown column ‘column_name’ in ‘field list'» error.

  • MySQL ALTER TABLE Statement
  • MySQL Data Types
  • MySQL Primary Key

Понравилась статья? Поделить с друзьями:
  • Ошибка 1075 mysql
  • Ошибка 1073 что значит
  • Ошибка 1074 windows 10
  • Ошибка 1073741819 касперский
  • Ошибка 1073741701 лира