masterofdestiny
masterofdestiny

Reputation: 2811

Mysql : dump database along data

I want to dump my database along the table schema and the table data also using the unix command line .

I used .

mysqldump -d -u root  -p frontend > frontend.sql

But above command is dumping only schema not the data from the database .

Please help me out how can i dump the database along the data also.

Upvotes: 44

Views: 59494

Answers (7)

ktang
ktang

Reputation: 359

You're missing --no-data=False

e.g.

mysqldump -d -u root frontend --no-data=False -p > frontend.sql

Upvotes: 1

Bennet Joseph
Bennet Joseph

Reputation: 336

You just need to remove -d from your mysqldump command

Upvotes: 17

Rajesh M. Kanojia
Rajesh M. Kanojia

Reputation: 57

To restore database from .sql dumpfile

mysql -u [yourusername] -p [password] [nameofthedatabase] < /pathtoyoursqldumpfile.sql

Use mysqldump to create backup from database.

mysqldump -u [yourusername] -p [password] [nameofthedatabase] > /pathtoyoursqldumpfile.sql

Upvotes: 0

Nima Soroush
Nima Soroush

Reputation: 12814

mysqldump offers plenty of options to build a proper backup from your database:

mysqldump [options] db_name [tbl_name ...]
mysqldump [options] --databases db_name ...
mysqldump [options] --all-databases

Here you can find more detail about how to mysqldump:

http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html

Upvotes: 3

Raghvendra Parashar
Raghvendra Parashar

Reputation: 4053

backup: #

mysqldump -u root -p[password] [database_name] > dumpfilename.sql

restore:#

mysql -u root -p[password] [database_name] < dumpfilename.sql

[ref:] http://www.thegeekstuff.com/2008/09/backup-and-restore-mysql-database-using-mysqldump/

Upvotes: 21

Mariappan Subramanian
Mariappan Subramanian

Reputation: 10063

backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

This will do,

If your requirement is to dump data alone then go for this,

To export to file (data only)

mysqldump -u [user] -p[pass] --no-create-db --no-create-info mydb > mydb.sql

Upvotes: 51

Kevin Coyle
Kevin Coyle

Reputation: 9

I think the command you would need will be mysqldump. Try the following:

mysqldump -u root -p -h localhost frontend < frontend.sql

Upvotes: -3

Related Questions