For some odd reason, I always forget the stupid syntax for mysqldump. There are a bunch of options that you can use with this program, but if you just want to grab a simple dump of your database, use this command:
mysqldump -u[user] -p[password] [databasename] > dumpfile.sql


5 Comments
Suren Roy
—
Please give me an example…
Janaka
—
imagine that you want to dump database ‘test’ username is ‘mime’ & password is ‘abc’. then go to cmd(command prompt) & type
mysqldump -umime -pabc test > test.sql
Janaka
—
sorry i forgot something. After going to cmd you have to change the path to the bin folder of mysql
ex:- cd\ press enter then
cd C:\Program Files\MySQL\MySQL Server 4.1\bin
after path changed type above code.
THANK YOU
mandar pande
—
mysql> mysqldump -uroot -proot vaulttest9 > backup.sql;
as u said i typed above command bt it is giving me error
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near ‘mysql
dump -u root -proot vaulttest9 > backup.sql’ at line 1
jPl
—
you need to run it in the command line mandar.
“mysqldump” is an executable, not a MySQL command, and “>” is used to pipe the result of the dump into a file.