天天看點

MySQL中如何啟用InnoDB資料引擎

innodb 的設計目标是處理大容量資料時最大化性能,它的 cpu 使用率是其他所有基于磁盤的關系資料庫引擎中最有效率的。

./configure –prefix=/usr/local/mysql –with-extra-charsets=all –enable-thread-safe-client –enable-assembler –with-charset=utf8 –enable-thread-safe-client –with-extra-charsets=all –with-big-tables –with-readline –with-ssl –with-embedded-server –enable-local-infile --with-plugins=innobase

二、檢查目前mysql支援的資料庫引擎

在mysql的指令行模式下,可以用 show engines\g; 指令檢視各個引擎的狀态

mysql> show engines\g

*************************** 1. row ***************************

engine: myisam

support: default

comment: default engine as of mysql 3.23 with great performance

*************************** 2. row ***************************

engine: memory

support: yes

comment: hash based, stored in memory, useful for temporary tables

*************************** 3. row ***************************

engine: innodb

comment: supports transactions, row-level locking, and foreign keys

*************************** 4. row ***************************

engine: berkeleydb

support: no

comment: supports transactions and page-level locking

*************************** 5. row ***************************

engine: blackhole

comment: /dev/null storage engine (anything you write to it disappears)

*************************** 6. row ***************************

engine: example

comment: example storage engine

*************************** 7. row ***************************

engine: archive

comment: archive storage engine

*************************** 8. row ***************************

engine: csv

comment: csv storage engine

*************************** 9. row ***************************

engine: ndbcluster

comment: clustered, fault-tolerant, memory-based tables

*************************** 10. row ***************************

engine: federated

comment: federated mysql storage engine

*************************** 11. row ***************************

engine: mrg_myisam

comment: collection of identical myisam tables

*************************** 12. row ***************************

engine: isam

comment: obsolete storage engine

12 rows in set (0.00 sec)

這裡可以看到

也就是說,mysql已經支援了innodb引擎,但是并不是作為預設資料庫引擎。

三、啟用innodb的方法

1、關閉mysql的服務

2、修改/etc/my.cnf

将default-storage-engine=innodb前的注釋(#)去掉

将skip-innodb這行注釋(加上#)

将my.cnf中關于innodb的配置前面的#去掉

3、儲存後重新開機mysql服務(如果啟動服務時失敗,可以試着将innodb日志檔案清除 rm ib* ,然後重新啟動)