I want to add a solution that helped me. In case there is a multi-column primary key, the following would generate the same error:
CREATE TABLE book (
id INT AUTO_INCREMENT NOT NULL AUTO_INCREMENT,
accepted_terms BIT(1) NOT NULL,
accepted_privacy BIT(1) NOT NULL,
PRIMARY KEY (accepted_terms, id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
But the following works fine (=note the ordering of the PRIMARY KEY
):
CREATE TABLE book (
id INT AUTO_INCREMENT NOT NULL AUTO_INCREMENT,
accepted_terms BIT(1) NOT NULL,
accepted_privacy BIT(1) NOT NULL,
PRIMARY KEY (id, accepted_terms)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;