List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:March 19 2003 6:09pm
Subject:Re: Restoring from a .sql file
View as plain text  
At 12:31 -0500 3/19/03, Tab Alleman wrote:
>MySQL 3.23.54, Win2k Server:
>
>I am trying to take a .sql file that I got from a mysqldump from one
>mysql server, and use it to populate a new mysql server, as though I
>were restoring a backup after a total system crash.
>
>I am using the following command, following the only example I could
>find in the documentation ("mysql>" prompt shown for clarity):
>
>mysql> mysql < u:/db backup 20030318/cm_central.sql;
>
>But I get the following error message:
>
>ERROR 1064: You have an error in your SQL syntax near 'mysql < u:/db
>backup 2003
>0318/cm_central.sql' at line 1
>
>I'm going to try things like copying the file locally and taking the
>spaces out of the folder name, but also just wanted to ask if I'm even
>on the right track here.  Is this the correct way to import from a .sql
>file?

Nope.  But you knew that already! :-)

If you're in mysql already, use the SOURCE command:

mysql> SOURCE filename;

But that may not work with a filename that has colons, slashes, spaces, etc.

The < syntax can be used, but that's for use from the command line
prompt.  For example:

C:\> mysql < u:\db backup 20030318\cm_central.sql

Note that in this case you use backslashes.  I imagine you'll also
have to put quotes around the filename if it contains spaces.

-- 
Paul DuBois
http://www.kitebird.com/
sql, query
Thread
Restoring from a .sql fileTab Alleman19 Mar
  • Re: Restoring from a .sql fileRyan Fox19 Mar
Re: Restoring from a .sql filePaul DuBois19 Mar
RE: Restoring from a .sql fileTab Alleman19 Mar
RE: Restoring from a .sql filePaul DuBois19 Mar
RE: Restoring from a .sql fileTab Alleman19 Mar
RE: Restoring from a .sql filePaul DuBois19 Mar