Foreign key cannot be created id MySQL: missing index on column(s)
<p>I have a few foreign keys set up, however phpMyAdmin would not let me to create one more. Here are table in question:</p>

<pre><code>Groups Table

id
name
address


Tasks Table

id
group_id
name
</code></pre>

<p>I need a foreign key on <code>group_id</code> in <code>Tasks Table</code>, but when I try to create in it provides the following error: <code>Missing index on column(s)</code>. If I add a unique constrain on <code>group_id</code> I am then able to create the foreign key, but the ralation then becomes <code>One to One</code>, which is not the expected result.</p>

<p>Following are table create statements:</p>

<pre><code>CREATE TABLE IF NOT EXISTS `groups` (
  `id` int(11) NOT NULL,
  `name` varchar(256) NOT NULL,
  `address` varchar(256) NOT NULL,
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;

ALTER TABLE `groups`
  ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`), ADD UNIQUE KEY `id_2` (`id`);


CREATE TABLE IF NOT EXISTS `tasks` (
  `id` int(11) NOT NULL,
  `group_id` int(11) NOT NULL,
  `name` varchar(256) NOT NULL,
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

ALTER TABLE `fixed_tasks`
  ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`);
</code></pre>

<p>Any help or guidance is much appreciated.</p>