Jason
Jason

Reputation: 363

mysql restore file.sql syntax error using command line

when I input

mysql -u root -p XXXX dbname < c:/filename.sql

alway get this error "error 1064 <42000>:" you have an error in your SQL suntax; check the manual that corresponds to your MySql server version for the right syntax to use near .....

what is wrong with this statement?

Upvotes: 2

Views: 2139

Answers (3)

mifodiy
mifodiy

Reputation: 11

I resolved it using PowerShell:

Get-Content "c:/filename.sql" | .\mysql.exe -uroot -pXXXX dbname

Upvotes: 1

Jason
Jason

Reputation: 363

right one is C:\Program Files\MySQL\MySQL Server 5.0\bin>mysqldump -u root -p mysql>backup_database.sql Enter password: ********

my path not right. Should not log into mysql and then execute that statement

Upvotes: 0

leonm
leonm

Reputation: 6484

It is due to a reserved word in MySQL, typically because of a version mismatch.

http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html

Upvotes: 0

Related Questions