1、提高MySQL数据库管理系统的使用灵活性以及使用效率
2、指定了表的类型,表的存储方式,索引数据,是否支持事务
1、show engines:
show engines; show engines\g和show engines都是表示语句的结束,作用是一样的。 show engines\G是以行的方式显示
2、show variables:
ex:show variables like 'have_%'; 4.1.2版本以前
3、修改查看数据库的默认存储引擎:
MySQL安装目录---->新建添加一个my.ini文件----->编辑默认引擎 ex: [mysqld] #MySQL服务器的存储引擎 default-storage-engine = MylSAM
此时需要退出数据库:exit;
停止服务器:stop mysql;
重新开启服务器:start mysql;
再次show engines
则可以发现默认存储引擎已经更改
mysql> show engines; +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+ | Engine | Support | Comment | Transactions | XA | Savepoints | +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+ | MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO | | MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO | | CSV | YES | CSV storage engine | NO | NO | NO | | FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL | | PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO | | MyISAM | YES | MyISAM storage engine | NO | NO | NO | | InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES | | BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO | | ARCHIVE | YES | Archive storage engine | NO | NO | NO | +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
MyISAM不支持事务和外键,访问速度快
对事务完整性没有要求则可以选择MyISAM引擎
InnoDB支持事务,具备提交,回滚,恢复崩溃,比
MyISAM占用更多存储空间,更新数据更频繁
MEMORY采用内存存储数据
,如果要求访问速度非常快,可以采用此引擎,但是安全上没有保障