在 MySQL 中使用“TYPE = InnoDB”會引發異常?
可以將 ENGINE = InnoDB 替換掉 TYPE = InnoDB,因為在 MySQL 5.1 中 TYPE 的用法已廢棄。
我們用來演示的版本是 MySQL 版本 8.0.12。檢查一下 MySQL 版本。查詢如下 −
mysql> select version();
以下是輸出 −
+-----------+ | version() | +-----------+ | 8.0.12 | +-----------+ 1 row in set (0.00 sec)
以下是 TYPE = InnoDB 的示例。錯誤在 MySQL 8 中可見 −
mysql> create table Product_Information -> ( -> ProductId int, -> ProductName varchar(10), -> ProductDeliveryDate datetime -> )"TYPE = InnoDB"; ERROR 1064 (42000) − You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"TYPE = InnoDB"' at line 6
現在用 ENGINE 替換掉 TYPE。以下是 ENGINE 的示例 −
mysql> create table Product_Information -> ( -> ProductId int, -> ProductName varchar(10), -> ProductDeliveryDate datetime -> )ENGINE = InnoDB; Query OK, 0 rows affected (0.73 sec)
廣告