Fix MySQL Error #1064 - You have an error in your SQL syntax… near 'TYPE=MyISAM?


This error occurs when we use TYPE for ENGINE NAME. The error is as follows −

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

Now, in MySQL 8, you can use ENGINE instead of Type. Let us first create a table −

mysql> create table DemoTable1836
     (
     ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY,
     ClientName varchar(20)
     )ENGINE=MyISAM AUTO_INCREMENT=1;
Query OK, 0 rows affected (0.00 sec)

Insert some records in the table using insert command −

mysql> insert into DemoTable1836(ClientName) values('Chris');
Query OK, 1 row affected (0.00 sec)
mysql> insert into DemoTable1836(ClientName) values('David');
Query OK, 1 row affected (0.00 sec)
mysql> insert into DemoTable1836(ClientName) values('Mike');
Query OK, 1 row affected (0.00 sec)
mysql> insert into DemoTable1836(ClientName) values('Sam');
Query OK, 1 row affected (0.00 sec)

Display all records from the table using select statement −

mysql> select * from DemoTable1836;

This will produce the following output −

+----------+------------+
| ClientId | ClientName |
+----------+------------+
|        1 | Chris      |
|        2 | David      |
|        3 | Mike       |
|        4 | Sam        |
+----------+------------+
4 rows in set (0.00 sec)

Updated on: 24-Dec-2019

556 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements