Search code examples
mysqlsqlsyntax-errormysql-error-1064

How to fix SQL error 1064?


I've a problem, when I import the sql file after editing, it throws this error:

ErrorStatic analysis:2 errors were found during analysis.Unexpected
character. (near "" at position 0)Unexpected beginning of statement. 
(near "" at position 0)SQL query: SET SQL_MODE =
"NO_AUTO_VALUE_ON_ZERO"

MySQL said:

#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 ' SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"' at line 1

What should I do?


Solution

  • Do it like this:

    SET @SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
    select @SQL_MODE;