简体   繁体   中英

How to backup stored procedures in MySQL

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.

How can I back it up?

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?

mysqldump - u dbusername (ex: -uroot) -ppassword (ex:-pmysql@dbpas) --routines <dbname>

使用用户名和密码可能会更有帮助。

您还可以将routines=true放在my.cnf文件的[mysqldump]部分(您可能必须添加此部分,因为它通常不存在于原始my.cnf文件中)以在正常转储中包含例程。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM