File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Copy Mysql Database using mysqldump utility Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Copy Mysql Database using mysqldump utility" Watch "Copy Mysql Database using mysqldump utility" New topic

Copy Mysql Database using mysqldump utility

Ramesh kangamuthu
Ranch Hand

Joined: Mar 13, 2007
Posts: 79
Hi all,

I need to copy a part of database with data and another part of a database without data to a new database to my localhost.

for that I tried the 'mysqldump' command as directed by sites, where i got the information. But I did not get the result.

1. Is it possible to write a single 'mysqldump' option to copy some tables with data and some tables without data of a database to
another new database.?

I need it urgently. Can you share your ideas.


Ramesh Kangamuthu

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46374
We don't use the word "urgently" here.
Peter Johnson

Joined: May 14, 2008
Posts: 5852

What is the full command line for mysqldump that you have been using?

What do you mean by "another part of a database without data"? Do you mean that you have some tables that have data but you don't want the data, only the table definitions? I do not know of any way to tell mysqldump to not dump the data for specific tables. However, you can edit the resulting dump file to remove the INSERT statements that insert data into those tables.

JBoss In Action
Fatih Keles
Ranch Hand

Joined: Sep 01, 2005
Posts: 182
Hi Ramesh,

Surely you can dump only table definitions with "--no-data" directive. Also you can specify which tables to be dumped after database name separated by white spaces.

Have you checked out mysqldump manual for detailed explanation?


I agree. Here's the link:
subject: Copy Mysql Database using mysqldump utility
It's not a secret anymore!