views:

48

answers:

5

I want have a single database that uses InnoDB tables instead of myISAM tables (myISAM gives me good performance generally so I don't want to stop using it altogether).

Is it possible to specify that a database use InnoDB tables if the default is myISAM.

+1  A: 

If you use phpmyadmin, it's easy to specify what engine to use. I think this is done on a table by table basis. If you want the whole database to be InnoDB, just change that option for each table in the interface.

Dylan West
+2  A: 

The short answer is yes:

ALTER TABLE `my_table` Engine=InnoDB charset=utf8 collate=utf8_bin;
the_void
+1: Although altering auto_increment on non-empty table might not be the best idea.
Mchl
Yes, you are right. Fixed! :) Also, a poor choice in the `charset` will also lead to trouble, but that is heavily dependent on the stored data.
the_void
+1  A: 

You can always specify the engine type you want to use during table creation.

CREATE TABLE customers (a INT, b CHAR (20)) ENGINE=InnoDB;
tszming
+1  A: 

There is no way to specify a storage engine for a certain database, only for single tables, as others have pointed out. You can, however, specify a storage engine to be used during one session with

SET storage_engine=InnoDB;

so you don't have to specify it for each table.

thieger
+1  A: 

You can specify the database engine for the tables in the database. You can even have InnoDB and MyISAM engines for different tables within the same database.

I dont think you can specify the engine at the database level.

Satish Motwani