Tuesday, April 04, 2006

MySQL Database Dumping Command Quickie

I try and avoid using databases so much that I can never remember any commands, but I've had to look this up more than once:

DOS_PROMPT> mysqldump --user=[UID] --host=[server] --password --opt [database] > [filenameForDump.sql]


Lots more info is in the manual at:

MySQL 5.0 Reference Manual :: 8.10 mysqldump — A Database Backup Program

It alows you to dump the schema creation sql as well as sql to load the current data.

BTW, remember there's also
SET_FOREIGN_KEY_CHECKS=0
or
...=1
to enable / disable foreign key constraint checking for the duration of any upload

No comments: