Mysql : dump database along data

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/


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


You just need to remove -d from your mysqldump command


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

Tags:

Mysql

Sql

Dump