mysql查看和修改

一、查看引擎
1、 查看 mysql 引擎
1
SHOW ENGINES;
2、查看表引擎,方法一
SHOW TABLE STATUS from 数据库库名 where Name='表名';
1
SHOW TABLE STATUS from mytest where Name='test';
3、查看表引擎,方法二
mysqlshow -u 数据库登录帐号 -p '数据库登录帐号密码' --status 数据库库名 表名
1
mysqlshow -uroot -p123456 --status mytest test;

二、修改
1、方法一
1
2
alter table tt7 engine=innodb;
alter table tt7 engine=myisam;
2、方法二
1) 创建个和tt7同样表结构的表
1
create table tt7_tmp like tt7;
2) tt7_tmp作为中间结果集
1
insert into tt7_tmp select from tt7;
3) 删除原表的数据
1
truncate table tt7;
4) 这回更改原表的存储引擎
1
alter table tt7 engine=innodb;
5) 再把中间结果集的数据导回原表中
1
insert into tt7 select from tt7_tmp;
6) 删除中间表
1
drop table tt7_tmp;

猜你喜欢

转载自blog.51cto.com/14284608/2380329