zoukankan      html  css  js  c++  java
  • 【MySQL】修改表的存储引擎

    查看表的存储引擎用命令 show create table 表名

    更改表的存储引擎用命令 alter table 表名 set ENGINE=新引擎名

    示例如下:

    mysql> show create table t01;
    +-------+------------------------------------------------------------------------------------------------------------------------------------------+
    | Table | Create Table                                                                                                                             |
    +-------+------------------------------------------------------------------------------------------------------------------------------------------+
    | t01   | CREATE TABLE `t01` (
      `id` int(11) NOT NULL,
      `name` varchar(22) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
    +-------+------------------------------------------------------------------------------------------------------------------------------------------+
    1 row in set (0.05 sec)
    
    mysql> alter table t01 engine=MyISAM;
    Query OK, 0 rows affected (0.23 sec)
    Records: 0  Duplicates: 0  Warnings: 0
    
    mysql> show create table t01;
    +-------+------------------------------------------------------------------------------------------------------------------------------------------+
    | Table | Create Table                                                                                                                             |
    +-------+------------------------------------------------------------------------------------------------------------------------------------------+
    | t01   | CREATE TABLE `t01` (
      `id` int(11) NOT NULL,
      `name` varchar(22) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
    +-------+------------------------------------------------------------------------------------------------------------------------------------------+
    1 row in set (0.00 sec)
    
    mysql>

    玩完后记得改回原样哦。

    mysql> alter table t01 ENGINE=INNODB;
    Query OK, 0 rows affected (0.14 sec)
    Records: 0  Duplicates: 0  Warnings: 0
    
    mysql> show create table t01;
    +-------+------------------------------------------------------------------------------------------------------------------------------------------+
    | Table | Create Table                                                                                                                             |
    +-------+------------------------------------------------------------------------------------------------------------------------------------------+
    | t01   | CREATE TABLE `t01` (
      `id` int(11) NOT NULL,
      `name` varchar(22) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
    +-------+------------------------------------------------------------------------------------------------------------------------------------------+
    1 row in set (0.00 sec)

    --END--

  • 相关阅读:
    postgresql字符串函数
    ruby中的设计模式--策略模式
    (转)MySQL 性能优化的最佳20多条经验分享
    (转)ruby中的设计模式--模板方法
    观察者模式的应用
    postgresql的ARRAY_TO_STRING
    ruby和javascript的观察者模式
    mysql表连接的时候注意事项
    checkbox记忆功能的实现
    order by的注意事项
  • 原文地址:https://www.cnblogs.com/heyang78/p/15120365.html
Copyright © 2011-2022 走看看