English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

¿Cómo crear una tabla MySQL usando el motor de almacenamiento MyISAM?

Para crear una tabla MySQL utilizando el motor MyISAM, puede usar la orden ENGINE. Vamos primero a crear una tabla utilizando la orden CREATE.

mysql> create table StudentRecordWithMyISAM
   -> (
   -> Id int,
   -> StudentName varchar(100),
   -> StudentAge int
   -> )ENGINE=MyISAM;

En el ejemplo anterior, hemos configurado el motor como “MyISAM”.

Para verificar cuántas columnas hay en la tabla, utilice la orden DESC.

mysql> DESC StudentRecordWithMyISAM;

以下是输出。

+-------------+--------------+------+-----+---------+-------+
| Field       | Type         | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+-------+
| Id          | int(11)      | SÍ  |     | NULL    |       |
| StudentName | varchar(100) | SÍ  |     | NULL    |       |
| StudentAge  | int(11)      | SÍ  |     | NULL    |       |
+-------------+--------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

Verificar si la tabla se proporciona junto con MyISAM.

mysql>  SHOW TABLE STATUS FROM business LIKE 'StudentRecordWithMyISAM';

以下是清楚地表明引擎为MyISAM的输出。

+-------------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+--------------------+----------+----------------+---------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
+-------------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+--------------------+----------+----------------+---------+
| studentrecordwithmyisam | MyISAM |      10 | Dynamic | 0 | 0 0 0 0 | 281474976710655 |         1024 | 0 |              1 | 2018-10-22 15:47:01 | 2018-10-22 15:47:02 | NULL | utf8mb4_unicode_ci | NULL | NULL NULL NULL |
+-------------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+--------------------+----------+----------------+---------+
1 row in set (0.14 sec)

检查MyISAM表是否存在。

mysql> SELECT TABLE_NAME,
   -> ENGINE
   -> FROM information_schema.TABLES
   -> WHERE TABLE_SCHEMA = 'business' and ENGINE = 'MyISAM';

以下是输出。

+-------------------------+--------+
| TABLE_NAME                | ENGINE  |
+-------------------------+--------+
| studentrecordwithmyisam | MyISAM |
+-------------------------+--------+
1 row in set (0.00 sec)
Tutoriales de Elasticsearch