I need to auto_increment a field in MySQL that is not primary key
Just set a unique index on composite of (username, date). ALTER TABLE `table` ADD UNIQUE INDEX `name` (`username`, `date`); Alternatively, you can try to ALTER TABLE `table` DROP PRIMARY KEY, ADD PRIMARY KEY(`username`,`date`); and I think in the latter case you need those columns to be declared NOT NULL.