MySQL

How to Backup MySQL Data and Stored Procedures

By default, mysqldump only backup the data from which database indicated in the command line. For stored procedures, You have to enable the backup by adding an option –routines in the mysqldump command line. For example:
[root@test ~]# mysqldump --routines -u root -p database_name > dump.sql
Which routines oly include:
  1. Procedures
  2. Functions
If you additionally need events to be backed up, you should add –events in mysqldump[root@test ~]# mysqldump --routines --events -u root -p database_name > dump.sql
It makes the dump file include:
  1. Events
For MySQL 5.7, there’s a new client utility called mysqlpump which can backup all objects in databases by default without explicit declarations. You may refer to the document for more details:
MySQL :: MySQL 5.7 Reference Manual :: 4.5.6 mysqlpump — A Database Backup Program

Leave a Reply

Your email address will not be published. Required fields are marked *