Nasser Heidari

2010-02-14

Extract and Restore a Single Table from a mysqldump File

Filed under: Linux — Nasser Heidari @ 11:05

Original Document : http://blog.tsheets.com

This script will parse a full mysqldump file and extract the necessary portions required to restore a single table. The output is printed to STDOUT, so you’ll want to redirect to a file from the command line, like so: extract_sql.pl > somefile.sql

# extract_sql.pl -t mytable -r mydumpfile > mytable.sql
# mysql -utest -ptest mydb < mytable.sql

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: