mysql存储过程导入_mysql存储过程导入导出命令

MySQL 5 has introduced some newinteresting features, likeand.I will show in this small post how we can backup and restore these componentsusing mysqldump.

mysqldumpwill backup by default all the triggers but NOT the storedprocedures/functions. There are 2 mysqldump parameters that control thisbehavior:

–routines- FALSE by default

–triggers- TRUE by default

Thismeans that if you want to include in an existing backup script also thetriggers and stored procedures you only need to add the –routines commandline parameter:

mysqldump  --routines outputfile.sql

Let’sassume we want to backup ONLY the stored procedures and triggers andnot the mysql tables and data (this can be useful to import these in anotherdb/server that has already the data but not the stored procedures and/ortriggers), then we should run something like:

mysqldump --routines --no-create-info  --no-data --no-create-db --skip--opt > outputfile.sql

and thiswill save only the procedures/functions/triggers of the . If you need toimport them to another db/server you will have to run something like:

mysql    <  outputfile.sql

执行存储过程的用户需要两个权限.

grant  select on mysql.proc  to user@’’;

grant  execute on mysql.*  to user@’’

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值