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

前端 未结 6 504
不知归路
不知归路 2021-01-31 17:08
  • How can I determine type of mysql database : whether it is InnoDB or MyISAM ?
  • How can I convert MyISAM to InnoDB or vice-versa ?
相关标签:
6条回答
  • 2021-01-31 17:42

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

    0 讨论(0)
  • 2021-01-31 17:43

    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)

    0 讨论(0)
  • 2021-01-31 17:53
    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.

    ` != '

    0 讨论(0)
  • 2021-01-31 17:54

    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.

    0 讨论(0)
  • 2021-01-31 17:59

    Select the database in question and run show table status;

    0 讨论(0)
  • 2021-01-31 18:02

    Regarding converting myIsam to Innodb

    http://dev.mysql.com/doc/refman/5.0/en/converting-tables-to-innodb.html

    0 讨论(0)
提交回复
热议问题