我想更改数据库中的所有表类型,但不使用超级用户。我想尝试使用altertable脚本更改所有表。你知道我如何在列表选择查询结果上执行任何查询吗?
我创建的示例查询:
SELECT CONCAT("ALTER TABLE ", TABLE_SCHEMA,".",TABLE_NAME," ENGINE = InnoDB;") AS Querys
FROM information_schema.TABLES WHERE TABLE_SCHEMA = "database_name" AND ENGINE = "MyISAM"
查询的结果是:
+--------------------------------------------------------+
| Querys |
+--------------------------------------------------------+
| ALTER TABLE database_name.table_name1 ENGINE = innodb; |
| ALTER TABLE database_name.table_name2 ENGINE = innodb; |
| ALTER TABLE database_name.table_name3 ENGINE = innodb; |
| ALTER TABLE database_name.table_name4 ENGINE = innodb; |
+--------------------------------------------------------+
如何逐个/行执行表结果上的所有查询?
暂无答案!
目前还没有任何答案,快来回答吧!