Ошибка 1064 mysql как исправить
Перейти к содержимому

Ошибка 1064 mysql как исправить

  • автор:

How to Fix the MySQL Error 1064

When there is a syntax mistake in the SQL statement, MySQL Error Code 1064 is displayed. This indicates that MySQL does not recognise the command and issues an error. This post will show you how to work around the MySQL Error 1064.

Understanding the MySQL Error 1064 message

In MySQL, tracing down and fixing query or command problems might take a long time, especially for beginners. Before attempting to fix the error, you must first understand how MySQL generates the error message. The example below demonstrates how to interpret MySQL’s error 1064.

  • In an error message, the quotation denotes the first character of the query that MySQL is unable to perform. The quotation begins at ‘from Person’ in the example above. Because there is a comma before ‘from Person’ MySQL expects another column name in the SELECT clause rather than the keyword ‘from’ in the command.’
  • Look for the word… near ‘. ‘ in the error message to see where the error started. The error’s position is indicated by the first word (token) in the quotes and the last word in the quotes. Example: near ‘from Person’
  • If the error message contains . near ‘ ‘ but nothing between the quotes, MySQL does not identify where the query statement starts and ends. It could indicate that the query has unbalanced quotes (‘ or “), or that the parentheses are not balanced, or that the query is not properly terminated.
MySQL Reference Manual

Check the MySQL Reference Manual for updated features, commands, and obsolete commands that could be contributing to MySQL Error 1064 if you’re working on a new database version. Access the MySQL Reference Handbook; in the General Information portion of each version reference manual, you’ll find the What’s New section. It informs you about new features, deprecated commands, and other database-related information.

Using tools to validate MySQL command syntax

If you are new to MySQL commands then make use of platforms like EverSQL or MySQL Syntax Checker to validate your MySQL query. Copy and paste your code into the platform and it automatically validates your query.

How can I fix MySQL error #1064?

When issuing a command to MySQL, I’m getting error #1064 «syntax error».

What does it mean?

How can I fix it?

eggyal's user avatar

3 Answers 3

  • Read the error message. It tells you exactly where in your command MySQL got confused.

  • Examine your command. If you use a programming language to create your command, use echo , console.log() , or its equivalent to show the entire command so you can see it.

  • Check the manual. By comparing against what MySQL expected at that point, the problem is often obvious.

  • Check for reserved words. If the error occurred on an object identifier, check that it isn’t a reserved word (and, if it is, ensure that it’s properly quoted).

Aaaagh!! What does #1064 mean?

Error messages may look like gobbledygook, but they’re (often) incredibly informative and provide sufficient detail to pinpoint what went wrong. By understanding exactly what MySQL is telling you, you can arm yourself to fix any problem of this sort in the future.

As in many programs, MySQL errors are coded according to the type of problem that occurred. Error #1064 is a syntax error.

What is this «syntax» of which you speak? Is it witchcraft?

Whilst «syntax» is a word that many programmers only encounter in the context of computers, it is in fact borrowed from wider linguistics. It refers to sentence structure: i.e. the rules of grammar; or, in other words, the rules that define what constitutes a valid sentence within the language.

For example, the following English sentence contains a syntax error (because the indefinite article «a» must always precede a noun):

This sentence contains syntax error a.

What does that have to do with MySQL?

Whenever one issues a command to a computer, one of the very first things that it must do is «parse» that command in order to make sense of it. A «syntax error» means that the parser is unable to understand what is being asked because it does not constitute a valid command within the language: in other words, the command violates the grammar of the programming language.

It’s important to note that the computer must understand the command before it can do anything with it. Because there is a syntax error, MySQL has no idea what one is after and therefore gives up before it even looks at the database and therefore the schema or table contents are not relevant.

How do I fix it?

Obviously, one needs to determine how it is that the command violates MySQL’s grammar. This may sound pretty impenetrable, but MySQL is trying really hard to help us here. All we need to do is…

Read the message!

MySQL not only tells us exactly where the parser encountered the syntax error, but also makes a suggestion for fixing it. For example, consider the following SQL command:

That command yields the following error message:

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 ‘WHERE SET name=’foo» at line 1

MySQL is telling us that everything seemed fine up to the word WHERE , but then a problem was encountered. In other words, it wasn’t expecting to encounter WHERE at that point.

Messages that say . near » at line. simply mean that the end of command was encountered unexpectedly: that is, something else should appear before the command ends.

Examine the actual text of your command!

Programmers often create SQL commands using a programming language. For example a php program might have a (wrong) line like this:

If you write this this in two lines

then you can add echo $query; or var_dump($query) to see that the query actually says

Often you’ll see your error immediately and be able to fix it.

Obey orders!

MySQL is also recommending that we «check the manual that corresponds to our MySQL version for the right syntax to use«. Let’s do that.

I’m using MySQL v5.6, so I’ll turn to that version’s manual entry for an UPDATE command. The very first thing on the page is the command’s grammar (this is true for every command):

The manual explains how to interpret this syntax under Typographical and Syntax Conventions, but for our purposes it’s enough to recognise that: clauses contained within square brackets [ and ] are optional; vertical bars | indicate alternatives; and ellipses . denote either an omission for brevity, or that the preceding clause may be repeated.

We already know that the parser believed everything in our command was okay prior to the WHERE keyword, or in other words up to and including the table reference. Looking at the grammar, we see that table_reference must be followed by the SET keyword: whereas in our command it was actually followed by the WHERE keyword. This explains why the parser reports that a problem was encountered at that point.

A note of reservation

Of course, this was a simple example. However, by following the two steps outlined above (i.e. observing exactly where in the command the parser found the grammar to be violated and comparing against the manual’s description of what was expected at that point), virtually every syntax error can be readily identified.

I say «virtually all», because there’s a small class of problems that aren’t quite so easy to spot—and that is where the parser believes that the language element encountered means one thing whereas you intend it to mean another. Take the following example:

Again, the parser does not expect to encounter WHERE at this point and so will raise a similar syntax error—but you hadn’t intended for that where to be an SQL keyword: you had intended for it to identify a column for updating! However, as documented under Schema Object Names:

If an identifier contains special characters or is a reserved word, you must quote it whenever you refer to it. (Exception: A reserved word that follows a period in a qualified name must be an identifier, so it need not be quoted.) Reserved words are listed at Section 9.3, “Keywords and Reserved Words”.

The identifier quote character is the backtick (“ ` ”):

If the ANSI_QUOTES SQL mode is enabled, it is also permissible to quote identifiers within double quotation marks:

Error 1064: How to Fix SQL Syntax Error 1064?

Pooja Chaudhary linkedin | Updated On — November 30, 2022 |

Read time 5 minutes

At first, the syntax errors seem very tedious and cryptic while working with SQL database programs. But, at a closer glance, one can easily understand the errors as they are descriptive enough about the problem that finding possible solutions becomes a step easier. Every error code has a unique 4 digits number that determines the type of error. One such SQL error code is Error: 1064 which occurs due to wrongly typed syntax of SQL queries. Let’s dig deep to know more about this error and how to fix it.

The error message with error code 1064 occurs due to the incorrect syntax of MySQL queries. In simple words, MySQL does not understand the commands that you have written. The commands are mistyped or misspelled within the MySQL environment which the database does not recognize. Say for example UPDATE is typed as UPADTE. Also, don’t get confused between syntax error and grammar error, because grammar rules are valid for a syntax error. The parser disagrees to understand the command and fails to perform a task.

Reasons for MySQL Syntax Error: 1064

The possible reasons due to which MySQL faces syntax error – 1064 are mentioned here:

  • It can occur due to mistyping the spelling of command.
  • The error can take place due to the use of outdated or depreciated commands.
  • It may happen when the specific data required by the query goes missing.
  • Due to wrong reserved words typed as they vary from version to version in MySQL.
  • This occurs due to a mistake in the spelling of the command resulting in MySQL not being able to understand it.
  • The error can take place due to the use of outdated or obsolete commands which are no longer in function.
  • It may happen when some data goes missing in the written database.
  • Due to wrong reserved words typed as they vary from version to version in MySQL. Reserve words are used for specific context only.

Avail the fastest solution Kernel for MySQL Database recovery to fix SQL Syntax Error 1064. This software can quickly resolve problems related to MySQL Database.

When any MySQL error occurs, it indicates the problem along with a description and the way to fix it. Hence, for different syntax errors, it shows different fix solutions. Some of them are mentioned here, follow them according to the syntax error that is troubling you:

The foremost reason due to which 1064 error occurs when you type incorrect spelling of a command or typos.

Example: UDPATE table emp set > The UPDATE command is mistyped.

Solution to Fix

To fix the spelling errors mistyped commands and typos you must recheck before executing them. In case, you are unable to recall the correct syntax; we advise you to refer MySQL Manual and search for the syntax for the version you’re using. The error will get resolved if you replace all the typos and mistyped commands with the correct syntax.

You can also try IDEs and MySQL tools that help you with MySQL syntax errors by highlighting or pop-up alerts when you execute the query. If the IDE that you installed is lacking the feature of detecting syntax errors, look for a plugin that is designed for this purpose to debug the issue.

Reserved words vary from one MySQL version to another as every version has its list of keywords that are reserved. The reserved words are for performing a specific task and are used for different purposes in the MySQL database engine. The error 1064 might pop up in cases when you are not using the right keyword meant for serving the specific function, or the version of MySQL is not meeting the exact requirements for using the particular keyword.

For example, Create Table alter (name, id);

Here, alter is a reserved word, but it cannot be used as it needs some special requirements. Let’s know how to use a reserved keyword in a query.

Solution to Fix

To use alter in MySQL query as you need to fulfill the unique requirements to call the functionality of the alter command, you cannot use it as mentioned above. You need to enclose the alter word with backticks (`), present on your keyboard just above the Tab button.`

For example: Create Table `alter` (name, id);

At times, the relevant data goes missing from the database which is required for the execution of a query. Hence, leading to 1064 error when the data is not found in the database.

For example: Select * from students where studentID = $id

Suppose if the $id not correctly filled, the above query for the server is like this:

Select * from students where studentID =
That is the reason the server pops up error 1064 because it gets confused.
Solution to Fix

You can enter the missing data using the dashboard interface of the application, which is usually done through phpMyAdmin or MySQL Workbench. The applications allow you to bring up the record and add the missing data manually to an appropriate row of the table.

At times, the error 1064 becomes a bit tricky to resolve as it might occur due to the corruption of database files, i.e., MyIASM, .cnf, .ddl, .arm, etc. If that is the case, then you must use the professional automated solution to recover and restore database files of any MySQL server version. The best-recommended solution is the Kernel for MySQL Database recovery. The solution is highly efficient and works immediately to resolve problems caused by MySQL database files.

Concluding Words

The error 1064 seems simple to remove if you are aware of the exact cause behind the error. The manual solution may not work correctly if you do not use the correct steps to eliminate the error. You should use Kernel SQL Database Recovery software to handle each kind of error, whether physical or logical. The software will recover the complete databases with their tables, relationships, and dependencies.

MySQL 1064 Error: You have an error in your SQL syntax

So, you’re creating a custom SQL query to perform a task in the database. After putting the code together and running it in PHPmyAdmin it responds with a 1064 error. It may look similar to this:

1064 error message

The 1064 error displays any time you have an issue with your SQL syntax, and is often due to using reserved words, missing data in the database, or mistyped/obsolete commands. So follow along and learn more about what the 1064 error is, some likely causes, and general troubleshooting steps.

Note: Since syntax errors can be hard to locate in long queries, the following online tools can often save time by checking your code and locating issues:

Causes for the 1064 error

This may seem cryptic since it is a general error pointing to a syntax issue in the SQL Query statement. Since the 1064 error can have multiple causes, we will go over the most common things that will result in this error and show you how to fix them. Follow along so you can get your SQL queries updated and running successfully.

Using Reserved Words

Every version of MySQL has its own list of reserved words. These are words that are used for specific purposes or to perform specific functions within the MySQL engine. If you attempt to use one of these reserved words, you will receive the 1064 error. For example, below is a short SQL query that uses a reserved word as a table name.

How to fix it:

Just because the word alter is reserved does not mean it cannot be used, it just has special requirements to use it as the MySQL engine is trying to call the functionality for the alter command. To fix the issue, you will want to surround the word with backticks, this is usually the button just to the left of the “1” button on the keyboard. The code block below shows how the code will need to look in order to run properly.

Missing Data

Sometimes data can be missing from the database. This causes issues when the data is required for a query to complete. For example, if a database is built requiring an ID number for every student, it is reasonable to assume a query will be built to pull a student record by that ID number. Such a query would look like this:

If the $id is never properly filled in the code, the query would look like this to the server:

Since there is nothing there, the MySQL engine gets confused and complains via a 1064 error.

How to fix it:

Hopefully, your application will have some sort of interface that will allow you to bring up the particular record and add the missing data. This is tricky because if the missing data is the unique identifier, it will likely need that information to bring it up, thus resulting in the same error. You can also go into the database (typically within phpMyAdmin) where you can select the particular row from the appropriate table and manually add the data.

Mistyping of Commands

One of the most common causes for the 1064 error is when a SQL statement uses a mistyped command. This is very easy to do and is easily missed when troubleshooting at first. Our example shows an UPDATE command that is accidentally misspelled.

How to fix it:

Be sure to check your commands prior to running them and ensure they are all spelled correctly.

Below is the syntax for the correct query statement.

Obsolete Commands

Some commands that were deprecated (slated for removal but still allowed for a period of time) eventually go obsolete. This means that the command is no longer valid in the SQL statement. One of the more common commands is the ‘TYPE‘ command. This has been deprecated since MySQL 4.1 but was finally removed as of version 5.1, where it now gives a syntax error. The ‘TYPE‘ command has been replaced with the ‘ENGINE‘ command. Below is an example of the old version:

This should be replaced with the new command as below:

Error 1064 Summary

As you can see there is more than one cause for the 1064 error within MySQL code. Now, you know how to correct the issues with your SQL Syntax, so your query can run successfully. This list will be updated as more specific instances are reported.

Thoughts on “ MySQL 1064 Error: You have an error in your SQL syntax ”

Hello everyone, I have a php website with laravel framework. The problem is every now and then randomly images gets deleted from my website basically from the storage folder. I have set the permissions for folders and sub-folders to 775 but still it happens. What could be the issue? can anyone help?

I recommend reviewing the cPanel logs for any record of these files being accessed or edited. For example, your access logs or FTP logs may show the files being deleted or modified by a specific user. If you need assistance with this our Live Support team can provide a copy or help you search the logs.

Hello i have an error here can u pleas help me?
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘0) VALUES (Array)’ at line 1

INSERT INTO `dtl_peminjaman` (0) VALUES (Array)

It’s difficult to say without knowing the exact setup of your database, but you may not need to have single quotation marks around your table name and there would typically be a column name within the first parenthesis. For more information, I recommend reviewing the official MySQL documentation on the INSERT Statement, as it provides full details and examples.

Hello i have an error here can u pleas help me?
SELECT password FROM users WHERE password=” or ‘ 1=1’;
“ERROR: (1064, “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 ‘1=1”’ at line 1″)”

Hello Someone – Sorry for the issue with the SQL statement. You’re using the WHERE clause incorrectly. You need to be explicit when you’re defining it. Here’s an example (with OR): SELECT * FROM Customers
WHERE City=’Berlin’ OR City=’München’; Start with that, and if you’re still having issues with your code, I suggest speaking with an experienced SQL developer for further assistance.

remarks :
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 ‘INSERT INTO `ITEMS` VALUES (‘221004091058001’, ‘2210010001’, ‘001’, ”, ‘ at line 1:
INSERT INTO `ITEMS` VALUES (‘221004091058001’, ‘2210010001’, ‘001’, ”, ”, ”, ‘4’, ‘5’, ‘6’, ’76’, ’43’, ‘Y’)

Anand – all the code checkers confirm that there is a syntax issue in the INSERT INTO area of your code. The MySQL 8.0 reference provides these instructions for the INSERT command (https://dev.mysql.com/doc/refman/8.0/en/insert.html). You may need to speak with a database programmer if you require further assistance.

Thank You So Much For Great Information.

We’re glad you liked it!

Please I’m a newbie and i’m using the alain Beaulieu book ‘Learning SQL’ and on the first tutorial we need to add this function after creating the database ‘bank’. I have created it and typed the code but the shell returns the error after this code :

mysql>grant all privileges on bank.* to ‘lrngsql’@’localhost’ identified by ‘xyz’;
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 ‘identified by ‘xyz” at line 1

Here is a link to some helpful documentation on the GRANT statement, I don’t believe you would need the “identified by ‘xyz’;” section. This seems to be part of a CREATE USER statement possibly.

Hello Nigglestein – The code you’re using in the terminal may not apply to MySQL the way that you’re seeing it in your text. This may depend on the type of account that you have and the permissions you have for the MySQL database. The error does indicate a syntax issue. We would have to look directly at the code you used to see what’s wrong. You can also reference the command here: https://dev.mysql.com/doc/refman/8.0/en/grant.html. The easier way to apply ALL privileges per account is to create a MySQL database in cPanel. When you create the database, you will have an option to add the permissions to the user assigned to the account. (Create DB through cPanel: https://www.inmotionhosting.com/support/edu/cpanel/how-to-create-a-mysql-database-using-the-cpanel-api/).

ALTER TABLE employees
ADD CONSTRAINT `employees_cons_1` FOREIGN KEY (`reportsTo`) REFERENCES `employees` (`employeeNumber`),
CONSTRAINT `employees_cons_2` FOREIGN KEY (`officeCode`) REFERENCES `offices` (`officeCode`);

#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘CONSTRAINT `employees_cons_2` FOREIGN KEY (`officeCode`) REFERENCES `offices`…’ at line 3

Your “Add Constraint” does not seem to be formatted correctly, typically it would be followed by a name such as:
ADD CONSTRAINT name

Here is a helpful link to some documentation on the ALTER TABLE statement, it provides some helpful examples.

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ”4846280,01-01-1978 )’ at line 1

Hello Shmooke – Sorry for the problem with your MySQL(Maria DB) error. As the error states, it’s a syntax error, meaning that there’s a problem with either command or formatting of your code. Without the exact code, we can’t identify where the problem is located. We advise that you use a SQL code parser like the examples provided in the article. They will be able to help you narrow down where the error is occurring. Otherwise, you should speak with an experienced database programmer.

no ,it has not touched my problem,and this is the problem below
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 ‘Keys’ at line 1
i want to create a database and it is telling me that.

Hi, Jacob! Sorry to hear that you’re running into trouble here. How exactly are you creating the database? Is this part of the installation of some software, or through cPanel’s database utility?

I created a drop down list of states in the HTML form using data set present in the table named cool in my database in phpmyadmin. Names of states are present in the table “cool”. Now I created another table called “data” to store the user input values of name, address, contact and the email ID. I created a third table named “tab” which consists of ID and the stat columns to store the name of the state when the user selects from the drop down list. Now i tried joining tables “data” and “tab” using inner join in SQL. When I fetched the data and tried printing it in another web page , the name, email, contact and address are getting printed but the ID of the state in the table “cool” is getting printed instead of the name of state. I tried a lot to get the name of the state but always in vain.
I request you to help me fix this problem and print the name of the state instead of it’s ID in the web page !!

Your issue is a coding one with your database. We do not provide support for coding, so I recommend that you speak with an experienced developer or programmer. You can also find many tutorials for MySQL online that may provide the information you seek. Apologies that we cannot provide a direct solution for your issue.

I get this error when trying to import a database to phpmyadmin

3 errors were found during analysis.

Variable name was expected. (near ” ” at position 5)
Variable name was expected. (near ” ” at position 26)
Unrecognized statement type. (near “Host” at position 0)

Host: localhost (Version: 5.6.16) # Date: 2015-06-03 23:46:52 # Generator: MySQL-Front 5.3 (Build 4.122) /*!40101 SET NAMES utf8 */

MySQL said: Documentation
#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘Host: localhost (Version: 5.6.16)
# Date: 2015-06-03 23:46:52
# Generator: My’ at line 1

phpmy admin seemingly has a problem with this:

# Host: localhost (Version: 5.6.16)
# Date: 2015-06-03 23:46:52
# Generator: MySQL-Front 5.3 (Build 4.122)

/*!40101 SET NAMES utf8 */;

ERROR 1064 (42000) at line 6: 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 ‘

<link rel' at line 1

Operation failed with exitcode 1

It looks like there is an issue with how the query is coded. Unfortunately, we are unable to provide direct support for coding questions, so I recommend that you speak with an experienced developer or programmer. That said, I’d start by examining the early link syntax to see if it might be something simple like a missing comma or semi-colon. Apologies that we cannot provide a direct solution for your issue.

Hi I got this error when trying to import mysql database into phpmyadmin using a local XAMPP server. Please what probably go wrong?

Error:
Static analysis:

10 errors were found during analysis.

Unexpected character. (near “ <” at position 224)
Unexpected beginning of statement. (near “DOCTYPE” at position 2)
Unexpected beginning of statement. (near “HTML” at position 10)
Unexpected beginning of statement. (near “html” at position 16)
Unexpected beginning of statement. (near “lang” at position 21)
Unexpected beginning of statement. (near “‘en’” at position 26)
Unexpected beginning of statement. (near “dir” at position 31)
Unexpected beginning of statement. (near “‘ltr’” at position 35)
Unexpected beginning of statement. (near “meta” at position 42)
Unrecognized statement type. (near “charset” at position 47)

MySQL said: Documentation
#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘<meta name="ref' at line 1

The error indicates there is an issue with your syntax. This depends on your version of MySQL. I recommend that you review the documentation for the version of MySQL you are using to ensure you have the proper syntax in your code.

I got this error and I tried so many ways to fix it but I could not so can any one help me to figure it out !

This is the error :

1 errors were found during analysis.

Unexpected beginning of statement. (near “id11897681_admin” at position 0)
SQL query:

id11897681_admin SET time_zone = “+00:00”

MySQL said: Documentation

#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘id11897681_admin
SET time_zone = “+00:00″‘ at line 1

Sorry for the problem that you’re getting with the SQL Syntax. I’m not 100% sure of the issue but it appears to be possible syntax near the ID you’re using. The documentation shows three backticks before the timezone. Check it out in the MariaDB’s official documentation: https://mariadb.com/kb/en/library/time-zones/.

Hi Is there any possibilities to get a error code 00088x from SQL database, if there pls help me to fix it

Please provide more information and we can look into the issue further. Describe where/when the error occurs and provide the query.

Hello
mysql error but Apache is running xampp is a problem ( Error: MySQL shutdown unexpectedly.
This may be due to a blocked port, missing dependencies,
improper privileges, a crash, or a shutdown by another method.
Press the Logs button to view error logs and check
the Windows Event Viewer for more clues
If you need more help, copy and post this
entire log window on the forums)

Someone can help me.

Hello – A MySQL shutdown can happen for any number of reasons. We would advise following the recommendation of using the log files to determine when the shutdown occurred and if the event can be duplicated. You may need to submit a ticket with our live technical support team, or you may need to speak with an experienced MySQL developer for further assistance. If you are getting a specific error due to Syntax, we would need more information on the MySQL query where the error is happening. If you have any further questions or comments, please let us know.

Executing SQL script in server

ERROR: Error 1064: 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 ‘(16) NOT NULL,

`password` (32) NOT NULL,

`create_time`’ at line 5

CREATE TABLE IF NOT EXISTS `mydb`.`user_1` (

`username` (16) NOT NULL,

`password` (32) NOT NULL,

`create_time` NULL DEFAULT CURRENT_TIMESTAMP)

SQL script execution finished: statements: 9 succeeded, 1 failed

Fetching back view definitions in final form.

Nothing to fetch

Executing SQL script in server

ERROR: Error 1064: 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 ‘(16) NOT NULL,

`password` (32) NOT NULL,

`create_time`’ at line 5

CREATE TABLE IF NOT EXISTS `mydb`.`user_1` (

`username` (16) NOT NULL,

`password` (32) NOT NULL,

`create_time` NULL DEFAULT CURRENT_TIMESTAMP)

SQL script execution finished: statements: 9 succeeded, 1 failed

Fetching back view definitions in final form.

Nothing to fetch

Thanks for post on the MYSQL syntax error. The error indicates that the variable you’re building is not being properly defined. You need to indicated what each item is going to be. For example:

CREATE TABLE pet (name VARCHAR(20), owner VARCHAR(20),
species VARCHAR(20), sex CHAR(1), birth DATE, death DATE);

Specify what your variables are supposed to be in the table, then it should work.

I am getting this error when using SQl Developer and trying to “monitor sessions” in a mysql database. I can access the mysql database and look at tables, run queries, etc., and I have increased max_allowed_packets per a few other posts.

Sorry for the problem with the error when trying monitor sessions. We would need to see the MySQL query in order to troubleshoot the problem. Otherwise, we recommend speaking with an experienced database developer to resolve the issue.

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 ‘default(Cus_name,Rs_status,Acc_type,Acc_class,Currency,Init_deposit,Dob,Gender,M’ at line 1.
this error how to solve plz help me

Hello Sandar – sorry for the syntax error. We would need to see more of the MySQL query in order to determine the problem. I would recommend that you speak with an experienced developer or review your code to find the syntax issue that is causing the error to appear.

hello I’am getting an error through my workbench while I’m trying to forward engineer.

CREATE TABLE IF NOT EXISTS `electronics`.`customer_order` (

`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,

`amount` DECIMAL(6,2) NOT NULL,

`date_created` TIMESTAMP NOT NULL,

`confirmation_number` INT NOT NULL,

`customer_id` INT UNSIGNED NOT NULL,

INDEX `fk_customer_order_customer` (`customer_id` ASC) VISIBLE,

FOREIGN KEY (`customer_id`)

REFERENCES `electronics`.`customer` (`id`)

ON DELETE NO ACTION

ON UPDATE NO ACTION)

COMMENT = ‘Maintain the details of the customer order’

SQL script execution finished: statements: 9 succeeded, 1 failed

End the error is

ERROR: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘

FOREIGN KEY (`customer_id`)

According to the MySQL checker provided above, the following line needs to be checked:
INDEX `fk_customer_order_customer` (`customer_id` ASC) VISIBLE,

when i import a database from wamp i get an error that ther is an error in line one

create databse student_mgt charset utf-8;

Depends on how you’re doing the import. If you’re logged into WAMP and you have already created that database, then that line would not be needed and you can just import the structure. If you have any further questions or comments, please let us know.

hii there ,,

for the following database im getting these errors, could you please help me encounter teh errors.

<?php
$c_album=”CREATE TABLE IF NOT EXISTS album (
aid int(11) NOT NULL auto_increment,
aperformer_id int(11) NOT NULL default ‘0’,
aname varchar(200) NOT NULL,
bio_short text,
bio_long text,
PRIMARY KEY (aid),
KEY aperformer_id (aperformer_id),
KEY aname (aname)
) ENGINE=MyISAM;”;

$c_fav=”CREATE TABLE IF NOT EXISTS fav (
id int(11) NOT NULL auto_increment,
track_id int(11) NOT NULL default ‘0’,
performer_id int(11) default NULL,
album_id int(11) default NULL,
name varchar(200) NOT NULL,
duration varchar(6) default NULL,
last_played varchar(20) default NULL,
times_played int(11) NOT NULL default ‘0’,
year varchar(4) default NULL,
user_id int(11) NOT NULL default ‘0’,
fav_name varchar(80) NOT NULL default ”,
PRIMARY KEY (id),
KEY fav_name (fav_name),
KEY user_id (user_id),
KEY track_id (track_id)
) ENGINE=MyISAM;”;

$c_fav_shares=”CREATE TABLE IF NOT EXISTS fav_shares (
id int(11) NOT NULL auto_increment,
owner_id int(11) NOT NULL default ‘0’,
fav_name varchar(80) NOT NULL,
share_id int(11) NOT NULL default ‘0’,
PRIMARY KEY (id)
) ENGINE=MyISAM”;

$c_performer=”CREATE TABLE IF NOT EXISTS performer (
pid int(11) NOT NULL auto_increment,
pname varchar(200) NOT NULL,
bio_short text,
bio_long text,
PRIMARY KEY (pid),
KEY pname (pname)
) ENGINE=MyISAM;”;

$c_queue=”CREATE TABLE IF NOT EXISTS queue (
qid bigint(20) NOT NULL auto_increment,
user_name varchar(80) NOT NULL,
track_id bigint(20) NOT NULL default ‘0’,
PRIMARY KEY (qid),
KEY user_name (user_name)
) ENGINE=MyISAM;”;

$c_track=”CREATE TABLE IF NOT EXISTS `track` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`performer_id` int(11) DEFAULT NULL,
`album_id` int(11) DEFAULT NULL,
`track_no` smallint(6) DEFAULT NULL,
`name` varchar(200) NOT NULL,
`duration` varchar(6) DEFAULT NULL,
`last_played` varchar(20) DEFAULT NULL,
`times_played` int(11) NOT NULL DEFAULT ‘0’,
`year` varchar(4) DEFAULT NULL,
`path` text COLLATE latin1_danish_ci,
`echonest_id` varchar(20) NOT NULL DEFAULT ‘-1’,
`echonest_tempo` varchar(8) NOT NULL DEFAULT ‘-1’,
`echonest_loudness` varchar(8) NOT NULL DEFAULT ‘-1’,
`echonest_danceability` varchar(8) NOT NULL DEFAULT ‘-1’,
`echonest_energy` varchar(8) NOT NULL DEFAULT ‘-1’,
`echonest_mode` varchar(2) NOT NULL DEFAULT ‘-1’,
`echonest_key` varchar(2) NOT NULL DEFAULT ‘-1’,
`echonest_time_signature` varchar(2) NOT NULL DEFAULT ‘-1’,
`echonest_status` varchar(10) NOT NULL DEFAULT ‘-1’,
`echonest_liveness` varchar(8) NOT NULL DEFAULT ‘-1’,
`echonest_speechiness` varchar(8) NOT NULL DEFAULT ‘-1’,
`echonest_acousticness` varchar(8) NOT NULL DEFAULT ‘-1’,
`echonest_valence` varchar(8) NOT NULL DEFAULT ‘-1’,
PRIMARY KEY (`id`),
KEY `performer_id` (`performer_id`),
KEY `album_id` (`album_id`),
KEY `name` (`name`),
KEY `year` (`year`),
KEY `echonest_tempo` (`echonest_tempo`),
KEY `echonest_loudness` (`echonest_loudness`),
KEY `echonest_danceability` (`echonest_danceability`),
KEY `echonest_energy` (`echonest_energy`),
KEY `echonest_mode` (`echonest_mode`),
KEY `echonest_key` (`echonest_key`),
KEY `echonest_time_signature` (`echonest_time_signature`),
KEY `echonest_liveness` (`echonest_liveness`),
KEY `echonest_speechiness` (`echonest_speechiness`),
KEY `echonest_acousticness` (`echonest_acousticness`),
KEY `echonest_valence` (`echonest_valence`)
) ENGINE=MyISAM;”;

$c_user=”CREATE TABLE IF NOT EXISTS `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(80) NOT NULL,
`email` varchar(80) NOT NULL DEFAULT ‘0’,
`password` varchar(80) NOT NULL,
`password_salt` varchar(40) NOT NULL DEFAULT ‘0’,
`last_login` varchar(40) NOT NULL DEFAULT ”,
`last_ip` varchar(40) NOT NULL DEFAULT ”,
`admin` tinytext NOT NULL,
`lang` char(2) NOT NULL DEFAULT ”,
`count` mediumint(9) NOT NULL DEFAULT ‘0’,
`enqueue` char(1) DEFAULT ‘0’,
`cssfile` varchar(80) NOT NULL DEFAULT ”,
`icon_dir` varchar(80) DEFAULT NULL,
`disp_last_played` char(1) DEFAULT ‘1’,
`disp_times_played` char(1) DEFAULT ‘1’,
`disp_id_numbers` char(1) DEFAULT ‘1’,
`disp_jump_to` char(1) DEFAULT ‘1’,
`disp_duration` char(1) DEFAULT ‘1’,
`disp_totals` char(1) DEFAULT ‘1’,
`disp_related_performers` char(1) DEFAULT ‘1’,
`confirm_delete` char(1) DEFAULT ‘1’,
`can_download` char(1) DEFAULT ‘0’,
`can_upload` char(1) DEFAULT ‘0’,
`disp_download` char(1) DEFAULT ‘0’,
`disp_upload` char(1) DEFAULT ‘0’,
`disp_lyrics` char(1) DEFAULT ‘0’,
`hide_icon_text` char(1) NOT NULL DEFAULT ‘0’,
`disp_fav_shares` char(1) DEFAULT ‘0’,
`disp_small_images` char(1) DEFAULT ‘1’,
`browse_albums_by_covers` char(1) DEFAULT ‘0’,
`browse_performer_by_picture` char(1) DEFAULT ‘0’,
`autoplay` char(1) DEFAULT ‘0’,
`autoplay_num_tracks` int(11) NOT NULL DEFAULT ‘1’,
`autoplay_list` varchar(80) DEFAULT ‘Tracks’,
`autoplay_last` char(1) DEFAULT ‘0’,
`autoplay_last_list` varchar(80) DEFAULT NULL,
`ask4favoritelist` char(1) DEFAULT ‘0’,
`ask4favoritelist_disp_suggestion` char(1) NOT NULL DEFAULT ‘0’,
`disp_now_playing` char(1) DEFAULT ‘0’,
`disp_now_playing_add2favorite` char(1) NOT NULL DEFAULT ‘0’,
`avoid_duplicate_entries` char(1) DEFAULT ‘1’,
`auto_add2favorite` char(1) NOT NULL DEFAULT ‘0’,
`auto_add2favorite_create_new` char(1) NOT NULL DEFAULT ‘1’,
`auto_add2favorite_prefix` varchar(50) NOT NULL DEFAULT ‘AmpJuke_Automatically_added’,
`disp_help` char(1) DEFAULT ‘1’,
`welcome_num_items` smallint(6) NOT NULL DEFAULT ’10’,
`welcome_content_1` varchar(80) DEFAULT ‘Recently played tracks’,
`welcome_content_2` varchar(80) DEFAULT ‘Random albums’,
`welcome_content_3` varchar(80) DEFAULT ‘Random albums’,
`lame_local_enabled` char(1) DEFAULT ‘1’,
`lame_local_parameters` varchar(80) DEFAULT NULL,
`lastfm_active` char(1) DEFAULT ‘0’,
`lastfm_username` varchar(80) DEFAULT NULL,
`lastfm_password` varchar(80) DEFAULT NULL,
`xspf_active` char(1) NOT NULL DEFAULT ‘0’,
PRIMARY KEY (`id`),
KEY `name` (`name`),
KEY `password` (`password`)
) ENGINE=MyISAM;”;

?>
here are the errors :

Static analysis:

7 errors were found during analysis.

  1. Unexpected character. (near “?” at position 1)
  2. Unexpected character. (near “$” at position 7)
  3. Unexpected beginning of statement. (near “?” at position 1)
  4. Unexpected beginning of statement. (near “php” at position 2)
  5. Unexpected beginning of statement. (near “$” at position 7)
  6. Unexpected beginning of statement. (near “c_album” at position 8)
  7. Unexpected beginning of statement. (near “”CREATE TABLE IF NOT EXISTS album ( aid int(11) NOT NULL auto_increment, aperformer_id int(11) NOT NULL default ‘0’, aname varchar(200) NOT NULL, bio_short text, bio_long text, PRIMARY KEY (aid), KEY aperformer_id (aperformer_id), KEY aname (aname) ) ENGINE=MyISAM;”” at position 16)

SQL query:

<?php $c_album=”CREATE TABLE IF NOT EXISTS album ( aid int(11) NOT NULL auto_increment, aperformer_id int(11) NOT NULL default ‘0’, aname varchar(200) NOT NULL, bio_short text, bio_long text, PRIMARY KEY (aid), KEY aperformer_id (aperformer_id), KEY aname (aname) ) ENGINE=MyISAM;”

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *