在 MySQL 中将 row_format 更改为动态?

mysqlmysqli database

要在 MySQL 中将 row_format 更改为动态,语法如下:

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 更改为动态的查询:

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


相关文章