Resolve MySQL ERROR 1064 (42000): You have an error in your syntax?


This error occurs if let’s say you used var_char instead of varchar type. To remove this type of error, use, for example, varchar(100) instead of var_char(100).

Let us now see how this error occurs −

mysql> create table removeErrorDemo
   -> (
   -> StudentId int,
   -> StudentName var_char(50)
   -> );

The following is the output displaying the error −

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 'var_char(50)
)' at line 4

Now let us remove the error. Here is the query to remove error 1064 (42000) −

mysql> create table removeErrorDemo
   -> (
   -> StudentId int,
   -> StudentName varchar(100)
   -> );
Query OK, 0 rows affected (1.72 sec)

Above, we have set varchar correctly, therefore no error will occur.

Updated on: 30-Jul-2019

5K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements