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--

  • 相关阅读:
    单行居中,2行居左,超过2行省略
    Angular2环境搭建
    数字保留2位小数
    结束循环函数
    获取元素的定位值
    $.extend
    node使用指南
    Telsa显卡比较
    Jupyter-notebook 不自动打开浏览器解决办法
    teamviewer连接未就绪的解决(Manjaro Linux)
  • 原文地址:https://www.cnblogs.com/heyang78/p/15120365.html
Copyright © 2011-2022 走看看