1. 程式人生 > >mysql查看和修改

mysql查看和修改

ins mysqlshow 密碼 stat 登錄 trunc select table inno

一、查看引擎
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;

mysql查看和修改