Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change mysql default engine to innodb

Tags:

I am using mac and I installed mysql using homebrew.

brew install mysql 

pretty standard installation.

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         | +------------+---------+------------------------------------------------------------+--------------+------+------------+ 

I would like innodb to be the default storage engine. What do I need to do?

like image 964
Nick Vanderbilt Avatar asked Jan 21 '11 23:01

Nick Vanderbilt


People also ask

What is the default storage engine in MySQL?

InnoDB : The default storage engine in MySQL 8.0. InnoDB is a transaction-safe (ACID compliant) storage engine for MySQL that has commit, rollback, and crash-recovery capabilities to protect user data.

Does MySQL 5.7 support InnoDB storage engine?

In MySQL 5.7, InnoDB is the default MySQL storage engine. Unless you have configured a different default storage engine, issuing a CREATE TABLE statement without an ENGINE clause creates an InnoDB table.


1 Answers

Under [mysqld] section in your ini file, add:

default-storage-engine = innodb 

It is usually /etc/my.cnf, but not sure about Mac.

From the 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 

The last one is never used by the daemon.

like image 94
Quassnoi Avatar answered Nov 02 '22 23:11

Quassnoi