我只需要转储存储过程:没有数据,没有表创建。如何使用 mysqldump 执行此操作?
我只使用以下命令转储我的存储过程:
mysqldump --routines --no-create-info --no-data --no-create-db --skip-opt databasename -u username -p > outputfile.sql
Run Code Online (Sandbox Code Playgroud)
但是生成的转储文件在每个过程声明之前不包含 DROP PROCEDURE IF EXISTS。
如何将 drop 查询添加到我的转储中?
谢谢你。
我需要创建一个转储文件,其中包含来自数据库的单个存储过程,而不是所有例程。
我试过这样的事情:
mysqldump -u root -pssmart --skip-triggers --no-create-info --no-data \
--no-create-db --skip-opt test_fshop SP_ITEM_SALES_REPORT -R \
> test_fshop_routines.sql
Run Code Online (Sandbox Code Playgroud)
这test_fshop是我的数据库名称,SP_ITEM_SALES是我的 SP。我想要我的 SP 作为 .sql 文件。