[PLUG] Basic MySql Question

D. Cooper Stevenson cooper at linux-enterprise.net
Wed Jun 26 23:28:36 PDT 2002


All;

Thanks to all of you who responded to my SQL question. I am warming up to it. Somehting that struck me was the idea that you could create a database definition with a text file; that's great!

It tells me that SQL databases are designed (at least in part) to be open and configurable. This level of control is what attracted me to Linux in the first place several years ago. 


-Cooper 

On Wed, Jun 26, 2002 at 07:30:42PM -0700, Richard Steffens wrote:
> Cooper Stevenson wrote:
> 
> > I would like to 1) create a customer database having contact name,
> > snail mail address, email address, telephone number 2) import a
> > comma-delimited file text file into the database.
> 
> Part I:
> 
> Where do you need to start? If you already have a MySQL user set up, you
> can create a database by running the mysql monitor and typing:
> 
> mysql> create database mycustomerdb;
> 
> If it worked you'll get a response like:
> 
> Query OK, 1 row affected (0.06 sec)
> 
> Quit the mysql monitor and create a file called customers.sql (or
> something) with the following contents:
> 
> create table customers
> ( customerid int unsigned not null auto_increment primary key,
>   name char(30) not null,
>   address char(40) not null,
>   city char(20) not null,
>   email char(20) not null
> );
> 
> Replace the field names above with the ones appropriate for your
> comma-delimited data, noting the lack of a comma after the last field.
> Leave off the not null part for any field you don't have data for in
> your existing file, or any field you won't want to require when you make
> additions later on.
> 
> Then, assuming you have a user named customerdbuser, and that you've
> assigned a password to that user, start the mysql monitor with the
> following:
> 
> >mysql -u customerdbuser mycustomerdb -p < customers.sql
> 
> Then, follow Greg Robillard's directions to load your db.
> 
> -- 
> Regards,
> 
> Dick Steffens
> "Quando Omni Flunkus Moritati"
> http://rsteff.home.attbi.com/
> 
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug

-- 
______________________________________________________
Cooper Stevenson        |cooper at metasource.us
UNIX/Linux Consultant   |PH: (541)791-1322
MetaSource Technologies |www.metasource.us
------------------------------------------------------




More information about the PLUG mailing list