Home > Database > Mysql Tutorial > body text

MySQL数据库MyISAM存储引擎转为Innodb的方法_MySQL

WBOY
Release: 2016-06-01 13:10:00
Original
919 people have browsed it

mysql数据库存储引擎为MyISAM的时候,在大访问量的情况下数据表有可能会出现被锁的情况,这就会导致用户连接网站时超时而返回502,此时就需要MySQL数据库MyISAM存储引擎转为Innodb。
步骤如下:

1、导出CentOS数据库的表结构

mysqldump -d -uxxx -p centos > centos_table.sql
其中-d参数表示不导出数据,只导出表结构

2、替换centos_table.sql里的MyISAM为INNODB

sed -i 's/MyISAM/INNODB/g' centos_table.sql

3、新建数据库centos_new,并导入表结构

mysql > create database centos_new;
mysql -uroot -p centos_new 可以通过show table status来检查表引擎是否为INNODB。

4、导出centos的数据

mysqldump -t -uroot -p centos > centos_data.sql
其中-t参数表示只导数据,不导表结构

5、导入数据到centos_new

mysql -uroot -p centos_new

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!