Using “TYPE = InnoDB” in MySQL throws an exception?


You can use ENGINE = InnoDB in place of TYPE = InnoDB, since the usage of TYPE became obsolete in MySQL version 5.1.

The version we are using for our example is MySQL version 8.0.12. Let us check the MySQL version. The query is as follows −

mysql> select version();

The following is the output −

+-----------+
| version() |
+-----------+
| 8.0.12    |
+-----------+
1 row in set (0.00 sec)

Here is the example of TYPE = InnoDB. Error is visible in 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

Now use ENGINE in place of TYPE. Here is an example of ENGINE −

mysql> create table Product_Information
   -> (
   -> ProductId int,  
   -> ProductName varchar(10),
   -> ProductDeliveryDate datetime
   -> )ENGINE = InnoDB;
Query OK, 0 rows affected (0.73 sec)

Updated on: 30-Jul-2019

278 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements