[lug] mysql table creation scripts

D. Stimits stimits at idcomm.com
Sun Jun 10 23:39:56 MDT 2001


John Starkey wrote:
> 
> > > Create the script and do:
> > >
> > > mysql -u root -p < script_file
> > >
> > > It will prompt you for the password and then do the deed.
> > >
> > > script_file should contain just the
> > >
> > > create table whatever (
> > > field1 text,
> > > RecordID int not null auto_increment,
> > > primary key( id ));
> > >
> > > You get the pic.
> >
> > This is *very* close to what I need. The one problem remaining is that
> > the mysqldump does not specify which db a given table belongs to; e.g.,
> > it might say a table name as "tablename", but if it belongs to a db
> > called "dbname", it fails to dump as "dbname.tablename". And the mysql
> > command does not offer a command line means to specify which db to use
> > on the command line. So I must still manually edit all the mysqldump
> > scripts to explicitly use the syntax "dbname.tablename" instead of just
> > "tablename".
> 
> mysql database_name -u root -p < script_file
> 
> Should put it in the correct DB. Sorry.

Ok (*sounds of head bonking on wall*), the man page fails to even
mention the database_name can be entered on the command line (under
"synopsis"). This works nicely. Thank you.

D. Stimits, stimits at idcomm.com

> 
> John



More information about the LUG mailing list