On Mon, Aug 18, 2003 at 11:32:31PM +0800, Bopolissimus Platypus wrote:
> On Monday 18 August 2003 19:10, Winelfred G. Pasamba wrote:
> > select field1, field2 into temp_table from the_big_table;
> >
> > then try
> > mysqldump --tables temp_table the_database > two_fields_backup.dump
> 
> include the primary key and any important relational keys in the select
> though.  you might need to restore later and if you don't have those
> relational keys... well, you wouldn't be able to restore from the backup.

Good advice, which I wanted to leave in even though I'm really replying
to the grandparent post.

Don't do the two-stage select/mysqldump.  Use this instead:

mysql -uname -ppw -Ddbname -B -N -e 'select primary_key, field1, field2 from table;' 
>two_fields_backup.txt

That'll put them into a tab-delimited format.  If you want to know the
field names in the file, just drop the "-N" and the first row will
contain the field names.  You can load it in later by using
> load data local infile 'two_fields_backup.txt' into table whatever ignore 1 rows;

Of course, you'll have to specify columns and all that.  If you don't
have the field names on the first row, omit the "ignore 1 rows" part.

Michael
-- 
Michael Darrin Chaney
[EMAIL PROTECTED]
http://www.michaelchaney.com/
--
Philippine Linux Users' Group (PLUG) Mailing List
[EMAIL PROTECTED] (#PLUG @ irc.free.net.ph)
Official Website: http://plug.linux.org.ph
Searchable Archives: http://marc.free.net.ph
.
To leave, go to http://lists.q-linux.com/mailman/listinfo/plug
.
Are you a Linux newbie? To join the newbie list, go to
http://lists.q-linux.com/mailman/listinfo/ph-linux-newbie

Reply via email to