openstack删除数据库中instance关联表(没验证)

来源:互联网 发布:曼哈顿软件 编辑:程序博客网 时间:2024/05/21 21:44

http://download.csdn.net/download/sweetburden2011/4492336

 

错误操作:mysql> delete from instances where id = 7;
错误提示: ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`nova`.`security_group_instance_association`, CONSTRAINT `security_group_instance_association_ibfk_2` FOREIGN KEY (`instance_id`) REFERENCES `instances` (`id`))
解决方案:
mysql> delete from security_group_instance_association where id=7;
 Query OK, 1 row affected (0.06 sec)
 
mysql> delete from instance_info_caches where id=7;
 Query OK, 1 row affected (0.06 sec)
 
mysql> delete from instances where id = 7;
 Query OK, 1 row affected (0.05 sec)