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
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.
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.
Execute dump query in terminal then it will work
mysql -u root -p <Database_Name> > <path of the input file>
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)
-> );`
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');
Save code below as command.sql
USE restaurant
TRUNCATE `orders`;
TRUNCATE `order_items`;
Then run
mysql -u root <comands.sql> output.tab