Sto cercando di eliminare un certo numero di chiavi esterne utilizzando:MySQL goccia Errore chiave esterna 152
ALTER TABLE `table` DROP FOREIGN KEY `fk_table_users1` , DROP FOREIGN KEY `fk_table_accounts1` , DROP FOREIGN KEY `fk_table_data1` ;
ma restituisce l'errore:
Error on rename of './db/table' to './db/#sql2-179c-288289' (errno: 152)
Ho eseguito SHOW ENGINE INNODB STATUS
che dice:
120725 12:38:37 Error in dropping of a foreign key constraint of table db/table,
in SQL command
ALTER TABLE `table` DROP FOREIGN KEY `fk_table_users1` , DROP FOREIGN KEY `fk_table_accounts1` , DROP FOREIGN KEY `fk_table_data1`
Cannot find a constraint with the given id fk_table_users1.
SHOW CREATE TABLE 'table'
output:
CREATE TABLE `table` (
`id` int(11) NOT NULL auto_increment,
`data_id` int(11) NOT NULL,
`account_id` int(11) NOT NULL,
`status` enum('pending','complete') NOT NULL default 'pending',
`created_at` datetime NOT NULL,
`created_by` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_orders_users1` (`created_by`),
KEY `fk_orders_data1` (`data_id`),
KEY `fk_orders_accounts1` (`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
Tuttavia, quando guardo la struttura tramite phpmyadmin, elenca la chiave esterna con lo stesso nome. Devo fare qualcos'altro prima di poter lasciare le chiavi esterne?
Si prega di postare l'output di '' SHOW CREATE TABLE 'table';' '. – eggyal
@eggyal ha modificato il mio post con l'output – xylar
Non vedo * nessun * vincolo di chiave esterna lì ... – eggyal