简体   繁体   中英

How can I determine type of mysql database : whether it is InnoDB or MyISAM?

  • How can I determine type of mysql database : whether it is InnoDB or MyISAM ?
  • How can I convert MyISAM to InnoDB or vice-versa ?

To determine the storage engine being used by a table, you can use show table status . The Engine field in the results will show the database engine for the table. Alternately, you can select the engine field from information_schema.tables :

select engine 
from   information_schema.tables 
where  table_schema = 'schema_name'
   and table_name = 'table_name' 

You can change between storage engines using alter table :

alter table the_table engine = InnoDB;

Where, of course, you can specify any available storage engine.

选择有问题的数据库并运行show table status;

SHOW TABLE STATUS FROM `database`;

will list everything for all tables, starting with whether they are MyISAM or InnoDB. if you desire to list only data regarding 1 table, the syntax below may be used* :

SHOW TABLE STATUS FROM `database` LIKE 'table';

to change the table engine:

ALTER TABLE `table` ENGINE=InnoDB;

*attention use the GRAVE ACCENT (` backtick) for the database name and the table name and the SINGLE QUOTE (') for the comparison string (portion of table name) after LIKE.

` != '

Here is a query that lists all tables in all databases and their storage engines:

SELECT table_name, table_schema, engine
FROM information_schema.tables;

(From https://serverfault.com/a/244792/406647 )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM