-1

我们可以像在 Oracle 或 Sql Server 中那样在 MySQL 中编写存储过程来进行数据库备份吗?

我想在 MySQL 数据库中创建类似 Sql Server Job 的东西,它将每天进行备份。我们可以在 MySQL Event 中执行过程吗?

如果除此之外还有其他选择,请告诉我。

提前致谢。

4

2 回答 2

2

I've never seen a stored procedure that can back up a database. I would recommend not trying to code one yourself, because it's deceptively difficult to get right.

I've seen a number of shell scripts and PHP scripts that claim to create a database dump, but they usually fail in spectacular ways: not locking tables to ensure consistent snapshot, not handling NULL or not handling character set, not backing up procedures and triggers, etc.

The standard way of backing up on a schedule is to use one of the external tools like mysqldump, mydumper, or Percona XtraBackup, and write a cron job to invoke the preferred tool.

于 2013-06-17T12:13:29.740 回答
0

Mysql 已经为你创建了这个。Mysqldump 是备份数据的最佳选择。

于 2013-06-17T12:18:39.853 回答