Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set a MySQL database to use MyISAM by default?

Tags:

mysql

I have a MySQL server which has it's default storage engine set as InnoDB. I have a project which requires the tables in the database to be MyISAM. I'd like to create my database with a flag to set the default storage engine to be MyISAM. Is this possible without changing the server default and also without manually specifying each table?

like image 963
hellsgate Avatar asked May 23 '11 10:05

hellsgate


People also ask

Does MySQL use InnoDB by default?

InnoDB is the default and most general-purpose storage engine, and Oracle recommends using it for tables except for specialized use cases. (The CREATE TABLE statement in MySQL 8.0 creates InnoDB tables by default.)

What database engine does MySQL use by default?

There are two types of engines in MySQL: transactional and non-transactional. InnoDB is the default engine for MySQL 5.5 and above versions.


2 Answers

EDITED: Actually, yes - a global variable default-storage-engine can be changed only for a session, so

SET storage_engine=MYISAM;    
SET table_type=BDB;

will affect only the current session. See here for details.

like image 109
Unreason Avatar answered Oct 03 '22 10:10

Unreason


see this here: http://forums.mysql.com/read.php?21,26193,26193 you can change your database to MyISAM -- I'm guessing you're only reading from the tables in the database (otherwise if you have read/write transactions InnoDB is the better choice).

like image 27
Liv Avatar answered Oct 03 '22 11:10

Liv