HOME BLOG

How to dump stored MySQL routines

Posted on: June 12th, 2020 by Olu No Comments

Hi folks,

In this post I will quickly share how to make a MySQL dump of stored routines (procedures and functions). Recently, I was looking to back up databases for a MySQL server which I maintain. One of the databases contained a stored function. So, I thought, heh, let’s just use the good old mysqldump the way I do it with tables. Well, it didn’t work. After a bit of Googling and searching MySQL documentation, I eventually found the answer. All you have to do is add the routines flag when invoking mysqldump.

E.g.

 

mysqldump --routines -u youruser -p yourdb > yourdb.sql

 

That’s all for now.

Leave a Reply