List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:January 15 2001 11:43pm
Subject:Re: importing a table
View as plain text  
At 3:20 PM -0800 1/15/01, Matt Thoene wrote:
>Hello,
>
>I've just installed and am running MySQL for a web site that was recently
>moved to this box.  The previous webmaster did a mysqldump of a database we
>need and it has a .sql extension.  I've read in the manual where you can
>import from a text file but can't seem to find how to import a .sql file.

Take a look at it.  If it contains SQL statements (likely), you don't
import it, you feed it to mysql to execute the statements.  For example:

mysql db_name < filename.sql

>Is it possible?  Also, is it possible to do an import of a database file
>without having to create the database first?  I hope so since I'm not
>familiar with what the layout was of this .sql when it was sent to me.

The .sql file probably has CREATE TABLE statements in it.  If so, you only
need to create an empty database and let mysql execute the contents of
the .sql file to create the tables for you.  Creating the database is
simply a matter of executing:

CREATE DATABASE db_name;

-- 
Paul DuBois, paul@stripped
Thread
importing a tableMatt Thoene16 Jan
  • Re: importing a tablePaul DuBois16 Jan