(2.6)Mysql之SQL基礎——存儲引擎的查看與修改
(2.6)Mysql之SQL基礎——存儲引擎的查看與修改
可以使用
show engines;
查看數據庫支持的所有的存儲引擎;
目錄:
1、數據庫級別存儲引擎
1.1查看現在默認的存儲引擎
1.2 會話級別修改存儲引擎
2、表級存儲引擎
2.1 查看表現有的存儲引擎(三種方法)
2.2 修改表的存儲引擎
2.3 新建表時設置存儲引擎
3、查詢整個Mysql裏面存儲引擎為innodb/myisam的表
【1】查看整個實例:
【2】查看某個數據庫:
4、其他存儲引擎
4.1 archive(適用於大數據的插入與查詢)
1、數據庫級別存儲引擎
1.1查看現在默認的存儲引擎
show variables like ‘%storage%‘ ;
可以在my.cnf中設置 default-storage-engine = innodb (設置完後,重啟生效)
1.2 會話級別修改存儲引擎
set default_storage_engine=myisam ; #僅當前會話有效,重啟會恢復原來的配置。
2、表級存儲引擎
2.1 查看表現有的存儲引擎(三種方法)
【1】show create table test101;
【2】show table status from test1 where name = ‘test101‘;
【3】select * from information_schema.tables where table_schema=‘test1‘ and table_name = ‘test101‘;
2.2 修改表的存儲引擎
alter table test101 engine myisam;
2.3 新建表時設置存儲引擎
create table a2(id int,name varchar(20)) engine=archive;
3、查詢整個Mysql裏面存儲引擎為innodb/myisam的表
【1】查看整個實例:
select * from information_schema.tables where engine=‘innodb‘;
【2】查看某個數據庫:
select * from information_schema.tables where table_schema=‘test1‘ and engine=‘innodb‘;
4、其他存儲引擎
4.1 archive(適用於大數據的插入與查詢)
create table a2(id int,name varchar(20)) engine=archive;
(2.6)Mysql之SQL基礎——存儲引擎的查看與修改