I don't believe this can be accomplished with a trigger, either a BEFORE INSERT or AFTER INSERT. And the value assigned to the AUTO_INCREMENT column isn't available to expressions in the INSERT statement.
About the closest you are going to get (I think) is a separate UPDATE statement. The trick will be identifying the row(s) just inserted. One way would be to insert a NULL value to that column, and then update all rows that have a NULL in that column:
UPDATE mytable t
SET t.myidcol = CONCAT(DATE_FORMAT(NOW(),'%y-%i-'),t.id)
WHERE t.myidcol IS NULL;
(You didn't specify where that date value was coming from; the statement above uses the current date from the system. If it's a date column in the table, then use that instead. The DATE_FORMAT function converts a date/datetime/timestamp into a character string, based on the format supplied in the second argument.
EDIT
I may have read more into the "(aside from the index id used)" and "autoincrement" than was intended. I took this to mean that the table has an ID column defined as AUTO_INCREMENT. If that's not the case, then the answer above doesn't really work.
(This is where more details in the question i.e. the output from SHOW CREATE TABLE, and some example data, showing the types of values that would be assigned (whether the autoincrement id is "reset" for each distinct value 'yy-mm-', or whether its continuously ascending.)
If the value of the autoincrement portion is derived from a mechanism other than AUTO_INCREMENT, then the assignment of the value to the column could probably be done in a BEFORE INSERT trigger.
With all that said, I question the need to store a column in this format. (There is no apparent requirement is being met by the addition of this column, no reason given why this column is needed.)
If the date
and id
are stored as separate columns in the table, the generation of the formatted string is trivial, and could be handled in the SELECT list of a query. I can't see that this would be very useful for ordering, given that ordering on the string value is not guaranteed to sort the id values within a given yy-mm- in numerical order, without splitting it back out.