Why?

SQL query:

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

MySQL response:

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

Update

 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; 
  • in phpMyAdmin you press the key opposite the line with your id, then you put A_I - user208970

2 answers 2

Well, it’s quite well written. Only one column can be with the auto_increment attribute and it should be declared as a key (index or primary key)

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