Dumping stored procedures and functions in MySQL
MySQL does not by default include stored procedures and functions in when dumping data via it's mysqldump utility. In order to output the SQL for these the
–routines argument must be given.
The following command will dump all the stored procedures and functions for a given database but not any of database schema or data.
mysqldump --routines --no-create-info --no-data --no-create-db --skip-opt yourdatabase > /tmp/db_procedures.sql
The resulting file can then be loaded into another MySQL database or server.
Last updated: 28/08/2013