MySQL 如何备份MySQL中的存储过程
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/881223/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to backup stored procedures in MySQL
提问by freddiefujiwara
I use mysqldump
with MySQL 5.0 and I back it up every day, but do not understand the method that only stored procedure backs up.
我用mysqldump
MySQL 5.0,每天都备份,但是不明白只有存储过程备份的方法。
How can I back it up?
我怎样才能备份它?
回答by Stobor
I'm not sure whether you're asking to back up stored procedures as well as everything else, or just the stored procedures on their own...
我不确定您是要求备份存储过程以及其他所有内容,还是仅备份存储过程...
Stored procedured in dump with everything else:
与其他所有内容一起存储在转储中:
mysqldump -R <dbname> #or
mysqldump --routines <dbname>
Just the stored procedures:
只是存储过程:
mysqldump -n -t -d -R <dbname> #or
mysqldump --no-create-db --no-create-info --no-data --routines <dbname>
Does that help?
这有帮助吗?
回答by manoj
mysqldump - u dbusername (ex: -uroot) -ppassword (ex:-pmysql@dbpas) --routines <dbname>
use the username and password could be more helpful.
使用用户名和密码可能会更有帮助。
回答by David G
You can also put routines=true
in the [mysqldump]
section of your my.cnf
file (you may have to add this section as it is not usually present in a virgin my.cnf
file) to include routines in a normal dump.
您还可以放入文件routines=true
的[mysqldump]
部分my.cnf
(您可能必须添加此部分,因为它通常不存在于原始my.cnf
文件中)以在正常转储中包含例程。