Composite Primary Key and Auto_Increment [duplicate]
问题 This question already has answers here : mysql two column primary key with auto-increment (4 answers) Closed 7 years ago . I'm trying to do the composite key with one of them auto incrementing, but when I try to enter a new row it just continue the sequential. Here's the example of what happens: Item_1 | Item_2 1 | 1 1 | 2 2 | 3 2 | 4 2 | 5 Here's the example of what I want: Item_1 | Item_2 1 | 1 1 | 2 2 | 1 2 | 2 2 | 3 I create the table this way: CREATE TABLE IF NOT EXISTS `usuarios` ( `cod