Restoring a database backup to a local machine in MySQL I have downloaded my .sql file of my database server. It is in the D: drive of my Windows machine.

I want to restore the back up in my this machine. I used:

mysql database -u root &lt; backupfile.sql


Where database is my new database name in this machine. My confusion is that my backupfile.sql is in the D: drive and thus I guess there is error.

ERROR 1064 &lt;42000&gt;: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 'mysql database -u root &lt; backupfile.sql' at line 1.
You should login to mysql like this

C:\&gt; mysql -uroot -p &lt;hit enter&gt;
Enter password:


Next, select the database you want to load the data into

mysql&gt; CREATE DATABASE IF NOT EXISTS mynewdb;
mysql&gt; USE mynewdb


Then, run the script

mysql&gt; source D:\backup\backup.sql


Give it a Try !!!