add unique key to mysql table code example Example: mysql set field unique ALTER TABLE mytbl ADD UNIQUE (columnName);