当我们对引擎名称使用TYPE时,会发生此错误。错误如下-
mysql> create table DemoTable1836 ( ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY, ClientName varchar(20) )Type=MyISAM AUTO_INCREMENT=1; 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=MyISAM AUTO_INCREMENT=1' at line 5
现在,在MySQL 8中,您可以使用ENGINE而不是Type。让我们首先创建一个表-
mysql> create table DemoTable1836 ( ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY, ClientName varchar(20) )ENGINE=MyISAM AUTO_INCREMENT=1;
使用插入命令在表中插入一些记录-
mysql> insert into DemoTable1836(ClientName) values('Chris'); mysql> insert into DemoTable1836(ClientName) values('David'); mysql> insert into DemoTable1836(ClientName) values('Mike'); mysql> insert into DemoTable1836(ClientName) values('Sam');
使用select语句显示表中的所有记录-
mysql> select * from DemoTable1836;
这将产生以下输出-
+----------+------------+ | ClientId | ClientName | +----------+------------+ | 1 | Chris | | 2 | David | | 3 | Mike | | 4 | Sam | +----------+------------+ 4 rows in set (0.00 sec)