有個新項目在建表的時候疏忽了表類型晕讲,做事務的時候想起來表引擎需要為“InnoDB ”瓢省,就稍微折騰了下勤婚。
一鍵方法參上涤伐!
首先選中數(shù)據(jù)庫缨称,執(zhí)行睦尽。
SELECT CONCAT('ALTER TABLE ',table_name,' ENGINE=InnoDB;') FROM information_schema.tables
WHERE table_schema='db_name' AND ENGINE='MyISAM';
此sql會生成一排語句
ALTER TABLE wl_balance_log ENGINE=INNODB;
ALTER TABLE wl_cemetery ENGINE=INNODB;
ALTER TABLE wl_cemetery_access_records ENGINE=INNODB;
ALTER TABLE wl_cemetery_leave_message ENGINE=INNODB;
ALTER TABLE wl_cemetery_tree ENGINE=INNODB;
ALTER TABLE wl_cemetery_tree_growth_record ENGINE=INNODB;
ALTER TABLE wl_cemetery_tree_level ENGINE=INNODB;
ALTER TABLE wl_culturing_action ENGINE=INNODB;
ALTER TABLE wl_gift ENGINE=INNODB;
ALTER TABLE wl_gift_category ENGINE=INNODB;
ALTER TABLE wl_gift_order_log ENGINE=INNODB;
ALTER TABLE wl_gift_spec ENGINE=INNODB;
ALTER TABLE wl_grave_no ENGINE=INNODB;
ALTER TABLE wl_grave_no_rule ENGINE=INNODB;
ALTER TABLE wl_lisi_group ENGINE=INNODB;
ALTER TABLE wl_lisi_relation ENGINE=INNODB;
ALTER TABLE wl_memorial_hall ENGINE=INNODB;
ALTER TABLE wl_memorial_hall_type ENGINE=INNODB;
ALTER TABLE wl_memorial_type ENGINE=INNODB;
ALTER TABLE wl_music ENGINE=INNODB;
ALTER TABLE wl_recharge_log ENGINE=INNODB;
ALTER TABLE wl_religion ENGINE=INNODB;
ALTER TABLE wl_seed ENGINE=INNODB;
ALTER TABLE wl_transfer_log ENGINE=INNODB;
ALTER TABLE wl_user_seed ENGINE=INNODB;
ALTER TABLE wl_warehouse ENGINE=INNODB;
將語句復制后執(zhí)行当凡,即完成更改引擎操作纠俭。