Dumping MySQL Stored Procedures, Functions and Triggers
MySQL 5 has introduced some new interesting features, like stored procedures and triggers. I will show in this small post how we can backup and restore these components using mysqldump.
mysqldump will backup by default all the triggers but NOT the stored procedures/functions. There are 2 mysqldump parameters that control this behavior:
- —routines – FALSE by default
- —triggers – TRUE by default
This means that if you want to include in an existing backup script also the triggers and stored procedures you only need to add the —routines command line parameter:
1
|
|
Let’s assume we want to backup ONLY the stored procedures and triggers and not the mysql tables and data (this can be useful to import these in another db/server that has already the data but not the stored procedures and/or triggers), then we should run something like:
1
|
|
and this will save only the procedures/functions/triggers of the
1
|
|
'Story > mysql' 카테고리의 다른 글
MySQL Incorrect datetime value: '0000-00-00 00:00:00' (0) | 2017.06.14 |
---|---|
MySQL 5.6에서 Invalid value error (0) | 2014.04.17 |
mysql 에서 LOAD DATA INFILE 로 데이타 입력시 ERROR 1148 (42000) : The used command is not allowed 에러날경우 (0) | 2014.04.15 |
Example of MySQL SUBSTRING_INDEX() (0) | 2014.02.26 |
mdb 내용을 mysql 로 바꾸는 프로그램 (0) | 2014.02.24 |