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

MySQLMySQLi Database

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)
raja
Published on 27-Mar-2019 18:15:24
Advertisements