我使用的是 mac,我使用 homebrew 安装了 mysql。
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 成为默认存储引擎。我需要做什么?
最佳答案
在 ini 文件的 [mysqld]
部分,添加:
default-storage-engine = innodb
一般是/etc/my.cnf
,Mac就不确定了。
来自 docs :
On Unix, Linux and Mac OS X, MySQL programs read startup options from the following files, in the specified order (top items are used first).
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
最后一个永远不会被守护进程使用。
关于mysql - 将mysql默认引擎更改为innodb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4764974/