如何在MySQL中备份存储过程

时间:2021-10-28 16:29:58

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?

我该如何备份?

3 个解决方案

#1


43  

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?

这有帮助吗?

#2


0  

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

mysqldump - u dbusername(例如:-uroot)-ppassword(例如:-pmysql @ dbpas) - routines

use the username and password could be more helpful.

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

#3


0  

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.

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

#1


43  

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?

这有帮助吗?

#2


0  

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

mysqldump - u dbusername(例如:-uroot)-ppassword(例如:-pmysql @ dbpas) - routines

use the username and password could be more helpful.

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

#3


0  

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.

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