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

前端 未结 10 608
悲&欢浪女
悲&欢浪女 2021-02-01 04:28

While I am trying to insert a row to my table, I\'m getting the following errors:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that         


        
相关标签:
10条回答
  • 2021-02-01 04:41

    There are two different types of quotation marks in MySQL. You need to use ` for column names and ' for strings. Since you have used ' for the filename column the query parser got confused. Either remove the quotation marks around all column names, or change 'filename' to `filename`. Then it should work.

    0 讨论(0)
  • 2021-02-01 04:50
    C:\xampp>mysql -u root -p mydatabase < C:\DB_Backups\stage-new.sql
    Enter password:
    ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the ma
    nual that corresponds to your MySQL server version for the right syntax to use n
    ear 'stage-new.sql
    
    ----lot of space----
    
    ' at line 1
    

    The reason was when I dumped the DB I used following command :

    mysqldump -h <host> -u <username> -p <database> > dumpfile.sql
    dumpfile.sql
    

    By mistaken dumpfile.sql added twice in the syntax.

    Solution : I removed the dumpfile.sql text added to first line of the exported dumpfile.

    0 讨论(0)
  • 2021-02-01 04:50

    Execute dump query in terminal then it will work

    mysql -u root -p  <Database_Name> > <path of the input file>
    
    0 讨论(0)
  • 2021-02-01 04:53

    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 '<

    Very simple question that you can solved it easily ,

    Please follow my step : change < to ( and >; to );

    Just use: (

         );
    

    enter code here

    ` CREATE TABLE information (
    -> id INT(11) NOT NULL AUTO_INCREMENT,
    -> name VARCHAR(30) NOT NULL,
    -> age INT(10) NOT NULL,
    -> salary INT(100) NOT NULL,
    -> address VARCHAR(100) NOT NULL,
    -> PRIMARY KEY(id)
    -> );`
    
    0 讨论(0)
  • 2021-02-01 04:57

    Don't quote the column filename

    mysql> INSERT INTO risks (status, subject, reference_id, location, category, team,    technology, owner, manager, assessment, notes,filename) 
    VALUES ('san', 'ss', 1, 1, 1, 1, 2, 1, 1, 'sment', 'notes','santu');
    
    0 讨论(0)
  • Save code below as command.sql

    USE restaurant
    TRUNCATE `orders`;
    TRUNCATE `order_items`;
    

    Then run

    mysql -u root <comands.sql> output.tab
    
    0 讨论(0)
提交回复
热议问题