将mysql默认引擎更改为innodb

Nic*_*ilt 23 mysql

我正在使用mac,我使用自制软件安装了mysql.

brew install mysql
Run Code Online (Sandbox Code Playgroud)

非常标准的安装.

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         |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
Run Code Online (Sandbox Code Playgroud)

我希望innodb成为默认的存储引擎.我需要做什么?

Qua*_*noi 35

[mysqld]ini文件的部分下,添加:

default-storage-engine = innodb
Run Code Online (Sandbox Code Playgroud)

通常/etc/my.cnf,但不确定Mac.

来自文档:

在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
Run Code Online (Sandbox Code Playgroud)

最后一个从未被守护进程使用.