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 Try this: mysqldump -t database tablename Bob Silva> -----Original Message----- > From: rails-bounces@lists.rubyonrails.org [mailto:rails- > bounces@lists.rubyonrails.org] On Behalf Of Bruce Balmer > Sent: Sunday, January 22, 2006 9:31 AM > To: rails@lists.rubyonrails.org > Subject: [Rails] dumping out mysql data only (no structure) > > 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 > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Stuart Piltch
2006-Jan-22 18:21 UTC
[Rails] Re: dumping out mysql data only (no structure)
Bruce Balmer <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
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 On 22-Jan-06, at 10:30 AM, Bruce Balmer wrote:> 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 > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Possibly Parallel Threads
- counting rows via associations
- I don''t even know how to ask the question (4 lines of code)
- A book we may wish to buy
- How can one use GRUFF with locomotive ( I guess there is a wider question here, also)
- Trying to grasp the difference between local variables and instance variables/