Now that MySQL has Stored Procedures, Functions and Trigger. I have found myself needing to back them up or make copies to move to a different MySQL server. It’s actually pretty easy to do with mysqldump. Here is the command line for it.
shell> mysqldump –routines –no-create-info –no-data –no-create-db –skip-opt <database> > outputfile.sql
Then if you need to restore it.
shell> mysql <database> < outputfile.sql