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;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章