
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How to fix error “You have an error in your syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near… ”?
This kind of errors arise when you have used incorrect syntax. Let us see an example wherein we have created a table and the same error “1054” arise.
Here’s the table −
mysql> create table DemoTable689( UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY, UserName varchar(100), UserLoginDate date(100) NOT NULL );
This will produce the following output i.e. an error for incorrect syntax usage −
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 '(100) NOT NULL )' at line 5
Let us now fix the error 1054. For that, you need to use only DATE NOT NULL. Let us first create a table −
mysql> create table DemoTable689( UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY, UserName varchar(100), UserLoginDate date NOT NULL ); Query OK, 0 rows affected (0.68 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable689(UserName,UserLoginDate) values('John',DATE(NOW())); Query OK, 1 row affected (0.40 sec) mysql> insert into DemoTable689(UserName,UserLoginDate) values('Chris','2018-01-21'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable689(UserName,UserLoginDate) values('Robert',CURDATE()); Query OK, 1 row affected (0.20 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable689;
This will produce the following output. Now, we have fixed the error −
+--------+----------+---------------+ | UserId | UserName | UserLoginDate | +--------+----------+---------------+ | 1 | John | 2019-07-21 | | 2 | Chris | 2018-01-21 | | 3 | Robert | 2019-07-21 | +--------+----------+---------------+ 3 rows in set (0.00 sec)
- Related Articles
- How to resolve the MySQL error “You have an error in your SQL syntax; check the manual\nthat corresponds to your MySQL server version for the right syntax to use near?”
- Fix MySQL ERROR 1064 (42000) check the manual that corresponds to your MySQL server version for the right syntax to use near ')'
- Resolve usage of quotes 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?
- Fix MySQL Error #1064 - You have an error in your SQL syntax… near 'TYPE=MyISAM?
- Resolve MySQL ERROR 1064 (42000): You have an error in your syntax?
- MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=10'?
- ERROR 1064 (42000): You have an error in your SQL syntax at zero fill column?
- Resolve Syntax error near “ORDER BY order DESC” in MySQL?
- Declare syntax error in MySQL Workbench?
- Fix Error in MySQL syntax while creating a table column with name “index”?
- MySQL syntax error (in SELECT query) while using ‘group’ as table name
- I want to use %> literal in JSP page. But it is throwing error. How to escape this syntax in JSP?
- Getting a syntax error unknown fields in SAP ABAP
- What is the MySQL syntax error in this query – Creating a table with reserved keyword?
- How to check for error in HTML?

Advertisements