Dumping out mysql data only (no structure)

Dumping out mysql data only (no structure)

Postby cccp » Mon Feb 09, 2009 1:45 pm

Is it possible? It is mentioned in AWDWR but I cannot find that
option in the MySQL documentation. I can dump the whole db or just
the structure, but I'd like to be able to dump just the contents.

User avatar
cccp
Newbie
Newbie
 
Posts: 35
Joined: Mon Apr 30, 2007 10:31 am

Re: Dumping out mysql data only (no structure)

Postby Darwin » Mon Feb 09, 2009 1:46 pm

There's a utility called "mysqldump" that's included in MySQL distributions. One
of the flags to mysqldump is "--no-create-info" so the following will dump all
the data in YOUR_DATABASE (in SQL INSERT format, ready to be loaded into another
MySQL instance)

Code: Select all
mysqldump --user=me --password=mypass --no-create-info YOUR_DATABASE > database_data_only.sql


One of the other useful flags is "--complete-insert" which will add the column
names to the insert statements (eg "INSERT user(id, first_name, last_name)
VALUES(1, 'A', 'User')). This is useful when your new database has a few extra
columns that weren't in the original dump file.

If you're looking for csv or tab-delimited format instead of SQL insert format,
I'd suggest writing a short Ruby script.

User avatar
Darwin
Full Member
Full Member
 
Posts: 111
Joined: Mon Oct 09, 2006 11:16 am
Location: Bradenton, FL


Return to MYSQL

Who is online

Users browsing this forum: No registered users and 1 guest

cron