I'm trying to restore a mysql5.5 dump file using mysql command prompt using the command given below:

mysql> -u <username> -p <password> <dbname> < <dumpfile>

But it is giving the below error:

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 '-u ro ot -p password mydb< "D:\mysql_dump\backup_2013_01_mydb.sql"' at line 1

Please help. I've tried it on both WinXP and Win7. Also please guide how to do the same using Mysql Workbench.

| improve this question | | | | |
  • On line 1? Did you dump from a Linux system and are restoring to a Windows one? Do you need to convert line endings? I'm not sure if that matters, but "line 1" seems suspicious. Otherwise, what is on line 1? – Bacon Bits Mar 4 '13 at 5:11
  • Hi Mat, the dump is also taken from windows system. – Neeru Sharma Mar 4 '13 at 6:41
  • What version of mysql was on the Windows box? Did you dump usign --all databases or did you dump a specific database ? – RolandoMySQLDBA Mar 4 '13 at 20:10
  • we are using mysql5.5 and we created the dump for a specific database. The cmd we are using is: set DATET=%date:~-4%_%date:~7,2% "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqldump" --host=localhost --user=root --password=root123 mydb >"d:\mysql_dump\"backup_%DATET%_mydb.sql pause – Neeru Sharma Mar 5 '13 at 5:16

Please check the link below for the answer.


Thank You

| improve this answer | | | | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.