[How-to] dump out MySQL Functions, Stored Procedures & Triggers

Scenario:

When working with MySQL Functions, Stored Procedures and Triggers, it is very important to know how to export those custom items out from MySQL. Default mysqldump command will not export out Functions, Stored Procedures or Triggers. So, additional parameters is required.

Below is the mysqldump example:

Solution:

View Code LINUX
user1@AP[~]$ mysqldump -u<DBUSER> -p -h<MYSQL_HOST> --routines --no-create-info --no-data --no-create-db <DATABASE_NAME> > dump.sql

* –no-create-info: exclude create table statement.
* –no-data: exclude insert data statement.
* –no-create-db: exclude create database statement.
* –routines: include Triggers, Functions and Stored Procedures

Leave a Reply