2011-01-21 133 views
22

我正在使用mac,并且我使用自制软件安装了mysql。将mysql默认引擎更改为innodb

brew install mysql 

非常标准的安装。

mysql> show engines; 
+------------+---------+------------------------------------------------------------+--------------+------+------------+ 
| Engine  | Support | Comment             | Transactions | XA | Savepoints | 
+------------+---------+------------------------------------------------------------+--------------+------+------------+ 
| MRG_MYISAM | YES  | Collection of identical MyISAM tables      | NO   | NO | NO   | 
| CSV  | YES  | CSV storage engine           | NO   | NO | NO   | 
| MyISAM  | DEFAULT | 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   | 
+------------+---------+------------------------------------------------------------+--------------+------+------------+ 

我想innodb是默认的存储引擎。我需要做什么?

回答

33

[mysqld]部分在您的INI文件,添加:

default-storage-engine = innodb 

它通常是/etc/my.cnf,但不知道有关Mac。

docs

在Unix,Linux和Mac OS X,从下面的文件读取启动选项,按照指定的顺序MySQL程序(顶部项被用于第一)。

File Name Purpose 

/etc/my.cnf   Global options 
/etc/mysql/my.cnf Global options (as of MySQL 5.1.15) 
SYSCONFDIR/my.cnf Global options 
$MYSQL_HOME/my.cnf Server-specific options 
defaults-extra-file The file specified with --defaults-extra-file=path, if any 
~/.my.cnf   User-specific options 

最后一个是从未使用过这个守护进程。

+0

哪里是我的ini文件。我如何找到mysql将在哪里查找ini文件。 – 2011-01-21 23:39:41

0

我可以从phpMyAdmin看到MySQL有一个名为information_schema的数据库,它包含一个名为ENGINES的表。除了更改ini文件的更全局的情况,难道不是将表SUPPORT字段切换为MyISAMInnoDB(分别为“YES”和“DEFAULT”)的简单解决方案?我自己并没有这样做,所以请自行承担风险......并让我知道事情的结果如果你这样做。