Home >Database >Mysql Tutorial >MySQL MyISAM 转 Innodb

MySQL MyISAM 转 Innodb

WBOY
WBOYOriginal
2016-06-07 17:51:121187browse

在开发时有时因需要把myisam数据库要转换成innodb数据库,这样的方法经常碰到,因为innodb支持存储过程等很多myisam不支持的类型,所在这里提供了一个方法,有需要的朋友可以参考一下。

! rm -f /tmp/ivan_alter.sql #预删除临时文件,方式下面的语句无法写入

 代码如下 复制代码


SELECT concat(‘alter table `’, TABLE_SCHEMA, ‘`.`’, TABLE_NAME, ‘` engine=innodb;’)
FROM information_schema.TABLES
WHERE ENGINE=‘Myisam’ AND
      TABLE_SCHEMA‘’ AND
      TABLE_SCHEMA‘information_schema’
INTO OUTFILE ‘/tmp/ivan_alter.sql’ ;


source /tmp/ivan_alter.sql

! rm -f /tmp/ivan_alter.sql

#执行完后删除临时文件

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn