[lug] mysql table creation scripts

John Starkey jstarkey at advancecreations.com
Sun Jun 10 22:46:28 MDT 2001


> There are also dumps of table structures in several databases of the
> mysql system, which I'd like to use to recreate, but I also do not want
> to use mouse copy and paste if not needed. I can use the LOAD command
> for actual data, but does anyone here know if I can directly source a
> file for SQL commands (the table creation scripts)?

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.

> Does anyone have an idea of a better way to use a mysqldump to make a
> duplicate of that dump on another machine with a freshly installed
> system? Updating passwords one at a time, mouse pasting table creation,
> so on, seems rather inefficient. And although LOAD of data from the
> dumped .txt files isn't entirely bad, it seems that there should be a
> mechanism in place that is the reverse of a dump, and it looks like
> maybe mysqlimport would still require manually listing files one at a
> time in nearly the same way as I have been doing it. What advice is
> there on use of a dump for duplication?

I'd just copy the data files over to the new drive. I've done it on a BSDi
to FreeBSD transfer with thousands of rows of data in 20 DBs and haven't
found any problems in the 3 months since. We didn't try a dump, so I don't
know of any advantages, just that it worked.

I'm also not totally sure I'm following the problem, so I can only hope
this helps.

John







More information about the LUG mailing list