How to export only procedures and functions using command prompt

There is a situation when you want to export only stored procedures and functions not tables and there data from your database.To get this you need to use (--routines) option with the mysqldump command. Below is the mysqldump command syntax:

Syntax :

mysqldump [option] [database_name] > [backupFileName]

Exapmle :
mysqldump -u cg_famcom -p --routines --no-create-info --no-data --no-create-db --skip-opt careyguides_production > /var/www/spbackup.sql


If you are logged in into database then you don't need to pass the user name and password with the mysqldump command. Now you command will be like below :

mysqldump --routines --no-create-info --no-data --no-create-db --skip-opt careyguides_production > /var/www/spbackup.sql


Please read my previous post for detail uses of options with mysqldump command.  Click Here

If you like this post please don't forgot to leave a comment.

Chears :)
Happy coding ...

Post a Comment

Previous Post Next Post