[PLUG] Basic MySql Question
D. Cooper Stevenson
cooper at linux-enterprise.net
Wed Jun 26 23:28:36 PDT 2002
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.
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
> >mysql -u customerdbuser mycustomerdb -p < customers.sql
> Then, follow Greg Robillard's directions to load your db.
> Dick Steffens
> "Quando Omni Flunkus Moritati"
> PLUG mailing list
> PLUG at lists.pdxlinux.org
Cooper Stevenson |cooper at metasource.us
UNIX/Linux Consultant |PH: (541)791-1322
MetaSource Technologies |www.metasource.us
More information about the PLUG