title: How to solve mysql ERROR 1062 (23000): Duplicate entry '' for key 'UK_ability_shortname'
body: <p>I am trying to add a unique key to a column and am getting an self explanatory error of</p>
  
  <pre><code>MariaDB [dnd]&gt; ALTER TABLE ability
      -&gt;   ADD UNIQUE INDEX UK_ability_shortname (shortname);
  ERROR 1062 (23000): Duplicate entry '' for key 'UK_ability_shortname'
  </code></pre>
  
  <p>But the thing is that I cannot see any duplicates</p>
  
  <pre><code>MariaDB [INFORMATION_SCHEMA]&gt; select * from INNODB_SYS_INDEXES WHERE NAME LIKE 'UK_%';
  +----------+---------------------------------+----------+------+----------+---------+-------+
  | INDEX_ID | NAME                            | TABLE_ID | TYPE | N_FIELDS | PAGE_NO | SPACE |
  +----------+---------------------------------+----------+------+----------+---------+-------+
  |     1733 | UK_food_food                    |      563 |    2 |        1 |       4 |   558 |
  |     1737 | UK_type_type                    |      565 |    2 |        1 |       4 |   560 |
  |     2077 | UK_invite_status_status         |      763 |    2 |        1 |       4 |   752 |
  |     2586 | UK_tool_class_name              |     1093 |    2 |        1 |       4 |  1082 |
  |     2591 | UK_food_drink_lodging           |     1097 |    2 |        2 |       4 |  1086 |
  |     2595 | UK_lifestyle_expenses_lifestyle |     1100 |    2 |        1 |       4 |  1089 |
  |     2691 | UK_weapon_name                  |     1173 |    2 |        1 |       4 |  1162 |
  |     2692 | UK_weapon_property_name         |     1174 |    2 |        1 |       4 |  1163 |
  |     2696 | UK_ability_name                 |     1183 |    2 |        1 |       4 |  1172 |
  +----------+---------------------------------+----------+------+----------+---------+-------+
  9 rows in set (0.00 sec)
  </code></pre>
  
  <p>Any ideas what else I can check to find out why the DB thinks there is a conflict in name or am I exceeding some index name limit?</p>
  
  <p>The table definition that I am trying to alter.</p>
  
  <pre><code>CREATE TABLE `ability` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(50) NOT NULL,
    `shortname` char(3) NOT NULL,
    `description` text,
    PRIMARY KEY (`id`),
    UNIQUE KEY `UK_ability_name` (`name`)
  ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='Page 175'
  </code></pre>
  
  <p>Using: Server version: 10.0.15-MariaDB MariaDB Server</p>
  
  <p>Let me know if I can provide any other information.</p>