Thinking about this, I think I am giving my input.
As was correctly pointed out in other answers, MySQL cannot have a UNIQUE index that has duplication.
I am not going to discuss the fact that this cannot be confused, or if you should even do something like that.
You can achieve what, in my opinion, will be the same result by having a regular index on my_column, but also setting it to NOT NULL (this is important since without this the trigger will not generate an error for duplicate indices). Then you can create TRIGGER for my_table as follows:
CREATE TRIGGER my_table_unique_index_with_exception BEFORE INSERT ON my_table FOR EACH ROW BEGIN IF NEW.my_column != 'xyz' THEN
Steve source share