I want to change mysql engine froom innodb to myisam, but fails

asked 2016-04-06 04:30:21 -0600

hope2k gravatar image

Hi, I have already delete the forein key of table 'askbot_post', but when I executes 'alter table askbot_post engine=myisam', it still returns the error 'ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails' , like below. " | askbot_post | CREATE TABLE askbot_post ( id int(11) NOT NULL AUTO_INCREMENT, post_type varchar(255) NOT NULL, old_question_id int(10) unsigned DEFAULT NULL, old_answer_id int(10) unsigned DEFAULT NULL, old_comment_id int(10) unsigned DEFAULT NULL, added_at datetime NOT NULL, endorsed tinyint(1) NOT NULL, endorsed_at datetime DEFAULT NULL, approved tinyint(1) NOT NULL, deleted tinyint(1) NOT NULL, deleted_at datetime DEFAULT NULL, wiki tinyint(1) NOT NULL, wikified_at datetime DEFAULT NULL, locked tinyint(1) NOT NULL, locked_at datetime DEFAULT NULL, score int(11) NOT NULL, vote_up_count int(11) NOT NULL, vote_down_count int(11) NOT NULL, comment_count int(10) unsigned NOT NULL, offensive_flag_count smallint(6) NOT NULL, last_edited_at datetime DEFAULT NULL, html longtext, text longtext, language_code varchar(16) NOT NULL, summary longtext, is_anonymous tinyint(1) NOT NULL, author_id int(11) NOT NULL, current_revision_id int(11) DEFAULT NULL, deleted_by_id int(11) DEFAULT NULL, endorsed_by_id int(11) DEFAULT NULL, last_edited_by_id int(11) DEFAULT NULL, locked_by_id int(11) DEFAULT NULL, parent_id int(11) DEFAULT NULL, thread_id int(11) DEFAULT NULL, PRIMARY KEY (id), UNIQUE KEY old_question_id (old_question_id), UNIQUE KEY old_answer_id (old_answer_id), UNIQUE KEY old_comment_id (old_comment_id), KEY askbot_post_01b0357b (post_type), KEY askbot_post_a604e731 (endorsed), KEY askbot_post_787d5f05 (approved), KEY askbot_post_da602f0b (deleted), KEY askbot_post_4f331e2f (author_id), KEY askbot_post_0ea2b072 (current_revision_id), KEY askbot_post_d19ec81d (deleted_by_id), KEY askbot_post_0fce4cbb (endorsed_by_id), KEY askbot_post_87f04f9b (last_edited_by_id), KEY askbot_post_36d90bd2 (locked_by_id), KEY askbot_post_6be37982 (parent_id), KEY askbot_post_e3464c97 (thread_id) ) ENGINE=InnoDB AUTO_INCREMENT=2857 DEFAULT CHARSET=utf8 |

mysql> alter table askbot_post engine=MyISAM; ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails " Does anyone meet this problem before? or can tell me how to alter the engine of mysql table.

Thanks a lot

edit retag flag offensive close merge delete