Dumping MySQL Stored Procedures, Triggers and Functions
10/2010 // Category: MySQL
mysqldump will backup by default all the triggers but NOT the stored procedures/functions. There are 2 mysqldump parameters that control this behavior:
* –routines – FALSE by default
* –triggers – TRUE by default
To include in an existing backup script also triggers and stored procedures, add the –routines command line parameter:
mysqldump--routines > dumpfile.sql
To dump only the stored procedures and triggers and not the mysql tables and data:
mysqldump --routines --no-create-info --no-data --no-create-db --skip-opt> dumpfile.sql
To import them to another database server run:
mysql< dumpfile.sql
Or with character encoding settings
mysql --default_character_set utf8 database< dumpfile.sql