简体   繁体   English

Mysql在数据库恢复期间禁用触发器

[英]Mysql Disable trigger during database recovery

I need to recover a database with a data-only DB dump (made only of "insert"). 我需要恢复一个只有数据的DB转储数据库(只有“插入”)。 I don't want to run triggers during this recovery, how can I do? 我不想在这次恢复期间运行触发器,我该怎么办?

If you have the option of recreating the dump, use the --skip-triggers option when running it. 如果您可以选择重新创建转储,请在运行时使用--skip-triggers选项。 You will have to recreate the triggers afterwards, but it's a lot less painful. 之后你将不得不重新创建触发器,但它不会那么痛苦。

MySQL Trigger Docs MySQL触发器文档

MySQL currently does not have this feature. MySQL目前没有此功能。 Here are some links that may be of interest and give some ideas. 以下是一些可能感兴趣并提供一些想法的链接。

Also, if you have the ability, you can make: 此外,如果你有能力,你可以:

  1. Backup triggers only 仅备份触发器
  2. Remove all triggers 删除所有触发器
  3. Restore database 恢复数据库
  4. Create triggers again 再次创建触发器

It's more work, but a workaround to lack of feature. 这是更多的工作,但有解决方法缺乏功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM