在 MySQL 中將 row_format 更改為 dynamic?


若要在 MySQL 中將 row_format 更改為 dynamic,語法如下

ALTER TABLE yourTableName ROW_FORMAT=DYNAMIC;

我們先建立一個表

mysql> create table DemoTable
(
   CustomerId int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   CustomerName varchar(200),
   CustomerAge int,
   CustomerAddress varchar(200)
);
Query OK, 0 rows affected (0.73 sec)

讓我們使用 DESC 命令查看錶說明

mysql> desc DemoTable;

這將產生以下輸出

+-----------------+--------------+------+-----+---------+----------------+
| Field           | Type         | Null | Key | Default | Extra          |
+-----------------+--------------+------+-----+---------+----------------+
| CustomerId      | int(11)      | NO   | PRI | NULL    | auto_increment |
| CustomerName    | varchar(200) | YES  |     | NULL    |                |
| CustomerAge     | int(11)      | YES  |     | NULL    |                |
| CustomerAddress | varchar(200) | YES  |     | NULL    |                |
+-----------------+--------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)

以下是將 row_format 更改為 dynamic 的查詢

mysql> alter table DemoTable ROW_FORMAT=DYNAMIC;
Query OK, 0 rows affected (1.05 sec)
Records: 0 Duplicates: 0 Warnings: 0

更新於: 2019 年 7 月 30 日

926 次瀏覽

開始您的職業生涯

完成課程獲得認證

開始學習
廣告
© . All rights reserved.