将mysql默认引擎更改为innodb
我使用mac,我使用自制软件安装mysql将mysql默认引擎更改为innodb,mysql,Mysql,我使用mac,我使用自制软件安装mysql brew install mysql 相当标准的安装 mysql> show engines; +------------+---------+------------------------------------------------------------+--------------+------+------------+ | Engine | Support | Comment
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
从:
在Unix、Linux和Mac OS X上,MySQL程序按照指定的顺序从以下文件中读取启动选项(首先使用顶部项目)
守护进程从不使用最后一个。我可以从phpMyAdmin中看到MySQL有一个名为
信息\u schema
的数据库,它包含一个名为引擎的表。除了更改ini文件这一更全局的场景之外,将表的支持字段切换为MyISAM
和InnoDB
(分别切换为“是”和“默认”)不是一个简单的解决方案?我自己没做过,所以你自己承担风险。。。如果您这样做了,请告诉我事情的结果。我的ini文件在哪里。我如何找到mysql在哪里查找ini文件。明白了/etc/my.cnf之所以有效,是因为我得到了mysql:unknown变量'default storage engine=innodb'@Nadal:你把它放在了[mysqld]
下面吗?在mac中,它也放在了/etc/my.cnf下面。感谢它的帮助。还建议使用innodb\u file\u per\u table
,以便数据库中的每个innodb表都有自己的.ibd
文件,而不是存储在单片ibdata1
文件中。请参阅作为起始参考。
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