# Dumping out mysql data only (no structure)

**URL:** <https://www.ruby-forum.com/t/dumping-out-mysql-data-only-no-structure/63998>\
**Category:** Rails\
**Created:** [January 22, 2006, 6:32pm UTC](https://www.ruby-forum.com/t/dumping-out-mysql-data-only-no-structure/63998 "2006-01-22T18:32:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brucebalmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@brucebalmer](https://www.ruby-forum.com/u/brucebalmer)\
**Post date:** [January 22, 2006, 6:32pm UTC](https://www.ruby-forum.com/t/dumping-out-mysql-data-only-no-structure/63998/1 "2006-01-22T18:32:10Z")

</div>

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.

bruce

---

<div class="post-metadata">

**Author:** ![brucebalmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@brucebalmer](https://www.ruby-forum.com/u/brucebalmer)\
**Post date:** [January 22, 2006, 7:24pm UTC](https://www.ruby-forum.com/t/dumping-out-mysql-data-only-no-structure/63998/2 "2006-01-22T19:24:15Z")

</div>

Hi Bruce

Try this:

mysqldump -t database tablename

Bob S.

---

<div class="post-metadata">

**Author:** ![brucebalmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@brucebalmer](https://www.ruby-forum.com/u/brucebalmer)\
**Post date:** [January 22, 2006, 7:24pm UTC](https://www.ruby-forum.com/t/dumping-out-mysql-data-only-no-structure/63998/3 "2006-01-22T19:24:16Z")

</div>

Bruce B. \<brucebalmer@…\> writes:

> 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.
> 
> bruce

Hi Bruce,

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)  
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.

Cheers,

- stuart

---

<div class="post-metadata">

**Author:** ![brucebalmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@brucebalmer](https://www.ruby-forum.com/u/brucebalmer)\
**Post date:** [January 23, 2006, 12:56am UTC](https://www.ruby-forum.com/t/dumping-out-mysql-data-only-no-structure/63998/4 "2006-01-23T00:56:20Z")

</div>

Thanks guys - worked like a charm. I had read it in the mysql docs  
but not realised what they meant. It’s great when more experienced  
people can save someone so much time.

Rails mailing list is awesome.

bruce
