4

Почему?

SQL-запрос:

ALTER TABLE  `media` CHANGE  `id`  `id` INT( 11 ) NOT NULL AUTO_INCREMENT

Ответ MySQL:

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

Обновление

CREATE TABLE IF NOT EXISTS `media` (
  `id` int(11) NOT NULL,
  `cat_id` int(9) NOT NULL,
  `title` varchar(255) NOT NULL,
  `info` varchar(255) NOT NULL,
  `dt` date NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
1
  • в phpMyAdmin жмешь на ключик напротив строки с твоим id, потом ставишь A_I
    – user208970
    24 апр 2016 в 7:27

2 ответа 2

7

Ну вполне ж понятно написано.. Только одна колонка может быть с атрибутом auto_increment и она должна быть объявлена ключом (index or primary key)

0
5
ALTER TABLE  `media` CHANGE  `id`  `id` INT( 11 ) primary key AUTO_INCREMENT

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.