【问题标题】:mysql lookup table schemamysql 查找表模式
【发布时间】:2011-05-28 20:06:39
【问题描述】:

有什么比show tables 更详细的查看表格属性的命令?特别是,我需要知道在我继承的数据库中使用了哪些存储引擎。

【问题讨论】:

    标签: mysql schema storage-engines


    【解决方案1】:

    您可以直接查询information_schema 表。

    SELECT `table_name`, `engine`
    FROM `information_schema`.`tables`
    WHERE `table_schema` = 'your_db'
    ORDER BY `table_name` ASC
    

    【讨论】:

    • 为什么所有这些过时的反引号`?与SQL无关,MySQL也可以处理标准双引号“,如果你需要的话。dev.mysql.com/doc/refman/5.5/en/…
    • @Frank Heikens:旧习惯很难改掉。使用双引号来引用标识符有什么好处吗?如果没有,为什么还要麻烦额外的配置?
    • 当与其他数据库一起工作时,反引号是一个巨大的 PITA :( 而且不需要它,MySQL 也可以处理双引号。
    【解决方案2】:
    show table status like '<tablename>'
    show create table <tablename>
    describe <tablename>
    show indexes from <tablename>
    

    【讨论】:

      猜你喜欢
      • 2022-07-25
      • 2014-09-12
      • 2012-06-03
      • 2019-11-29
      • 2014-06-06
      • 1970-01-01
      • 1970-01-01
      • 2016-10-24
      相关资源
      最近更新 更多