MySQL-将所有存储过程从一个模式复制到另一个模式 [英] MySQL - Copying all stored procedure from one schema to another

查看:183
本文介绍了MySQL-将所有存储过程从一个模式复制到另一个模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用SQL脚本以编程方式将所有存储过程从一种模式复制到另一种模式.

I need to copy all the stored procedures from one schema to another programmatically with an SQL script.

如何在MySQL中做到这一点?我不想运行PHP脚本.

How can I do this in MySQL? I don't want to have to run a PHP script.

谢谢

我在MySQL 8上.表mysql.proc不存在.而且,这些架构都在同一台服务器上.

I am on MySQL 8. Table mysql.proc doesn't exist. Also, the schemas are on the same server.

推荐答案

使用mysqldump从一个模式中转储例程 https://dev.mysql.com/doc/refman/8.0/en/mysqldump-stored-programs.html

Dump the routines from one schema with mysqldump https://dev.mysql.com/doc/refman/8.0/en/mysqldump-stored-programs.html

喜欢

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

并导入到新的

mysql -u root -p yournewdb < yourdb.sql

这篇关于MySQL-将所有存储过程从一个模式复制到另一个模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆