Home > Database > Mysql Tutorial > body text

MySQL MyISAM 转 Innodb

WBOY
Release: 2016-06-07 17:51:12
Original
1127 people have browsed it

在开发时有时因需要把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

#执行完后删除临时文件

 

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!