MariaDB (MySQL?) Unable to create foreign key - REFERENCES command denied
<p>I'm on MariaDB trying to set a foreign key on a table called isotemp referencing another table, called ISO-3166-2-status. I had added references to all previous tables in the same database with the same user before, but this time <code>Error Code: 1142. REFERENCES command denied to user 'symfony'@'localhost' for table 'ISO-3166-2-status.id'</code> happened. I went to consult the docs at (<a href="https://mariadb.com/kb/en/mariadb/grant/#table-privileges" rel="nofollow">https://mariadb.com/kb/en/mariadb/grant/#table-privileges</a>) and noticed the REFERENCES privilege is documented as "Unused" in both table as column contexts.</p>

<p>When I connected as root the command <code>GRANT REFERENCES ON geo.* TO symfony@localhost;</code> executes without error, although the error message persists. I then tried executing <code>GRANT REFERENCES ON geo.ISO-3166-2-status to symfony@localhost;</code> and <code>GRANT REFERENCES ON geo.isotemp to symfony@localhost;</code> which both executed without error, and the following is the output from the <code>SHOW GRANTS</code> command, as user <code>symfony</code>:</p>

<pre><code>GRANT FILE, REFERENCES ON *.* TO 'symfony'@'localhost' IDENTIFIED BY PASSWORD '************'
GRANT ALL PRIVILEGES ON `geo`.* TO 'symfony'@'localhost'
GRANT ALL PRIVILEGES ON `symfony`.* TO 'symfony'@'localhost'
GRANT REFERENCES ON `geo`.`ISO-3166-2-status` TO 'symfony'@'localhost'
GRANT REFERENCES ON `geo`.`isotemp` TO 'symfony'@'localhost'
</code></pre>

<p>...but still I cannot create the foreign key. The foreign key command in question: </p>

<pre><code>alter table isotemp add foreign key(statusid) references `ISO-3166-2-status`.`id`;
</code></pre>

<p>Here are my tables:</p>

<pre><code>SHOW CREATE TABLE `isotemp`;

CREATE TABLE `isotemp` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `country` varchar(50) DEFAULT NULL,
  `alpha` char(2) NOT NULL,
  `status` varchar(50) NOT NULL,
  `statusid` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=657 DEFAULT CHARSET=utf8

SHOW CREATE TABLE `ISO-3166-2-status`;

CREATE TABLE `ISO-3166-2-status` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status` char(24) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`),
  UNIQUE KEY `status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8
</code></pre>

<p>I have tried reconnecting and restarting the server, to no avail. Please tell me I'm overlooking something obvious. Eternal gratitude.</p>