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

MyISAMエンジンを使用してMySQLテーブルを作成する方法は何ですか?

MyISAMエンジンを使用してMySQLテーブルを作成するにはENGINEコマンドを使用できます。まずCREATEコマンドを使用してテーブルを作成します。

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

上記でエンジンを「MyISAM」に設定しました。

テーブルに何列があるか確認するにはDESCコマンドを使用してください。

mysql> DESC StudentRecordWithMyISAM;

以下は出力です。

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

テーブルが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 | 281474976710655 |         1024 |         0 |              1 | 2018-10-22 15:47:01 | 2018-10-22 15:47:02 | NULL | utf8mb4_unicode_ci | 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)
おすすめ