Search code examples
mysqldatabasestored-proceduresproceduredump

Export database with procedures using mysqldump


While exporting databases using mysqldump like this:

mysqldump -u mysqluser -p mysqlpassword databasename > /tmp/databasename.sql

Will this command also export stored procedures that listed using the following command:

SHOW PROCEDURE STATUS WHERE db = 'databasename';

If not, how to export mysql database using mysqldump along with its associated stored procedures from the Linux terminal? Also note that I cannot use phpMyAdmin for this purpose.


Solution

  • Try this.

    mysqldump -u mysqluser -p mysqlpassword --routines databasename > /tmp/databasename.sql

    Refer this link : http://www.ducea.com/2007/07/25/dumping-mysql-stored-procedures-functions-and-triggers/