Can Alter Table Engine = InnoDB be run on multiple tables at the same time?
Asked Answered
A

1

13

When it comes to MySQL and PHPMyAdmin, I'm not a novice, but I'm closer to novice than expert. Hopefully what I ask for is doable, and that someone will provide me with a simple, cut-n-paste SQL query to make it happen.

I need to convert around 9 tables in each of 12 dbs from MyISAM to InnoDB, and I'm hoping I can do all the tables in one db with a single query rather than having to click-and-wait for each and every table in PHPMyAdmin. Basically, is there a way to run "ALTER TABLE foo ENGINE = InnoDB" on multiple tables at once via a query run in PHPMyAdmin?

Anchoress answered 11/6, 2011 at 19:12 Comment(0)
S
34
select concat('alter table ',table_name, ' engine = innodb;')
from information_schema.tables
where table_schema in ('db1','db2',....,'dbN')

then run the query output.

Seko answered 11/6, 2011 at 19:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.