1. 查看MySQL存储引擎是用的哪个?登录MySQL数据库,在mysql>提示符下搞入show engines;命令。
mysql> show engines;
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| MRG_MYISAM | DEFAULT | Collection of identical MyISAM tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | YES | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
5 rows in set (0.00 sec)mysql>
说明目前默认的数据引擎是MyISAM,并且也支持InnoDB引擎。
2. 设置InnoDB为默认引擎:在配置文件my.cnf中的 [mysqld] 下面加入default-storage-engine=INNODB 一句,保存。
3. 重启mysql服务器:mysqladmin -u root -p shutdown或者service mysqld restart 登录mysql数据库,在mysql>提示符下搞入show engines;命令。如果出现 InnoDB |DEFAULT,则表示我们 设置InnoDB为默认引擎成功。