gpt4 book ai didi

mysql - 将 MySql 数据库从一台服务器复制到另一台服务器

转载 作者:太空宇宙 更新时间:2023-11-03 11:20:50 25 4
gpt4 key购买 nike

我需要将 MySQL 数据库从 Linux 上的服务器复制到 Windows 上的服务器。我试过使用 mysqldump 但它似乎不包括存储过程。我想复制所有内容,即架构、数据、存储过程、触发器等。

谢谢,唐

最佳答案

你想要 --routines 的“mysqldump”选项.

来自 --routines 标志的文档:

Dump stored routines (procedures and functions) from the dumped databases. Use of this option requires the SELECT privilege for the mysql.proc table. The output generated by using --routines contains CREATE PROCEDURE and CREATE FUNCTION statements to re-create the routines. However, these statements do not include attributes such as the routine creation and modification timestamps. This means that when the routines are reloaded, they will be created with the timestamps equal to the reload time.

If you require routines to be re-created with their original timestamp attributes, do not use --routines. Instead, dump and reload the contents of the mysql.proc table directly, using a MySQL account that has appropriate privileges for the mysql database.

This option was added in MySQL 5.1.2. Before that, stored routines are not dumped. Routine DEFINER values are not dumped until MySQL 5.1.8. This means that before 5.1.8, when routines are reloaded, they will be created with the definer set to the reloading user. If you require routines to be re-created with their original definer, dump and load the contents of the mysql.proc table directly as described earlier.

关于mysql - 将 MySql 数据库从一台服务器复制到另一台服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/971728/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com