Scenario:
I have a table which references two foreign keys, and for each unique combination of these foreign keys, has its own auto_increment column
Just add key(sr_no) on auto-increment column:
sr_no
CREATE TABLE `issue_log` ( `sr_no` INT NOT NULL AUTO_INCREMENT , `app_id` INT NOT NULL , `test_id` INT NOT NULL , `issue_name` VARCHAR(255) NOT NULL , primary key (app_id, test_id,sr_no), key (`sr_no`) );