因?yàn)镸ySQL默認(rèn)的是MyISAM數(shù)據(jù)引擎,不支持事務(wù)也不支持外鍵,所以需要用到Innodb引擎,于是決定將mysql的默認(rèn)引擎設(shè)置為innodb。
1 . 查看MySQL存儲(chǔ)引擎是用的哪個(gè)?登錄MySQL數(shù)據(jù)庫,在mysql>提示符下搞入show engines;命令。
+------------+---------+----------------------------------------------------------------+
-
| Engine | Support | Comment |
+------------+---------+----------------------------------------------------------------+
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables |
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys |
| BerkeleyDB | YES | Supports transactions and page-level locking |
| BLACKHOLE | NO | /dev/null storage engine (anything you write to it disappears) |
| EXAMPLE | NO | Example storage engine |
| ARCHIVE | NO | Archive storage engine |
| CSV | NO | CSV storage engine |
| ndbcluster | NO | Clustered, fault-tolerant, memory-based tables |
| FEDERATED | NO | Federated MySQL storage engine |
| MRG_MYISAM | YES | Collection of identical MyISAM tables |
| ISAM | NO | Obsolete storage engine |
+------------+---------+----------------------------------------------------------------+
說明目前默認(rèn)的數(shù)據(jù)引擎是MyISAM,并且也支持InnoDB引擎。
2. 設(shè)置InnoDB為默認(rèn)引擎:在配置文件my.cnf中的 [mysqld] 下面加入default-storage-engine=INNODB 一句,保存。
3. 重啟mysql服務(wù)器:mysqladmin -u root -p shutdown或者service mysqld restart 登錄mysql數(shù)據(jù)庫,在mysql>提示符下搞入show engines;命令。如果出現(xiàn) InnoDB |DEFAULT,則表示我們 設(shè)置InnoDB為默認(rèn)引擎成功。 本文出自:億恩科技【1tcdy.com】
服務(wù)器租用/服務(wù)器托管中國五強(qiáng)!虛擬主機(jī)域名注冊頂級提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]
|