Thursday, 19 July 2012

MySQL Script all Stored Procedures

The following will generate a script to recreate all stored procedures and functions for all MySQL databases in an instance.
mysqldump -u username -p -h servername --routines --no-create-info --no-data --no-create-db --skip-opt --all-databases > outputfile.sql
To recreate the routines on another server run the following:
mysql -u username -p -h servername < outputfile.sql
To view all stored procedures and functions use the following commands:
SHOW PROCEDURE STATUS SHOW FUNCTION STATUS

No comments:

Post a Comment