Computer >> 컴퓨터 >  >> 프로그램 작성 >> MySQL

MySQL에서 "TYPE =InnoDB"를 사용하면 예외가 발생합니까?

<시간/>

TYPE =InnoDB 대신 ENGINE =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

이제 TYPE 대신 ENGINE을 사용하십시오. 다음은 ENGINE의 예입니다 -

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