There are two ways to backup MySQL routine procedures and triggers. Either it could be with data and tables or without data and tables.
Backup:
DB Host: 172.16.16.29
DB Name: reportdb
DB Username: root
DB User Pass: abc123
Backup stored procedures with data and tables:
==================================
# mysqldump -h 172.16.16.29 -u root -p --routines reportdb > reportdb_proc_with_data_table.sql
When prompted, enter root password
Backup only Stored Procedures and Triggers:
=================================
# mysqldump -h 172.16.16.29 -u root -p --routines --no-create-info --no-data --no-create-db --skip-opt reportdb > reportdb_routine_proc.sql
When prompted, enter root password
Restore:
mysql -u root -p reportdb < reportdb_proc_with_data_table.sql
When prompted, enter root password
or
mysql -u root -p reportdb < reportdb_routine_proc.sql
When prompted, enter root password
No comments:
Post a Comment