在哪里可以找到 MySQL 事务日志?

发布于 2024-09-13 07:20:03 字数 76 浏览 1 评论 0原文

MySQL 是否保留事务日志?如果有,我在哪里可以找到它?

许多行被神秘地从表中删除,我想尝试看看它是如何以及何时发生的。

Does MySQL keep a transaction log and if so where could I find it?

A number of rows have mysteriously been deleted from a table and I want to try and see how and when it occurred.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

送你一个梦 2024-09-20 07:20:03

如果你打开 - mysql可以跟踪二进制日志,其中包含所有修改(要清楚 - 它包含已更改某些内容的查询)。

但无论如何,如果您没有在二进制日志打开之前进行的初始转储,那么它是没有用的。另外我想如果你进行转储并打开二进制日志 - 你就不会问这样的问题:-S

If you turned on - mysql can track binary log, which contains all the modifications (to be clear - it contains the queries that had changed something).

But anyway, it is useless if you do not have the initial dump, which precedes the binlog turning on. Also i suppose if you made the dump and turned on binlog - you would not ask such question :-S

简单 2024-09-20 07:20:03

简短回答:默认情况下不是。

为了获得准确的日志记录结果,您需要首先使用参数 --log-bin=your-file-name 以二进制日志记录模式启动服务器。然后,它创建一个二进制日志文件 {your-file-name.seq},其中 seq 是后续日志文件的序列号(建议将您的文件名放在那里,并具有明确的目录位置)。

有关解释所有详细信息的 MySQL 站点的更多信息: https:// /dev.mysql.com/doc/refman/5.7/en/binary-log.html

Short answer: not by default.

In order to have accurate logging results, you need to have started the server in binary logging mode first, using the parameter --log-bin=your-file-name. It then creates a binary log file {your-file-name.seq} where seq is a sequence number for subsequent log files (recommended to put your file name there, with explicit directory location).

More information on the MySQL site explaining all the details: https://dev.mysql.com/doc/refman/5.7/en/binary-log.html

半窗疏影 2024-09-20 07:20:03

如果您在 Windows 上使用 MySql,则在 C:\Program Files\MySQL\MySQL Server 5.0\data 中有一个文件(假设安装目标为 C: 驱动器且 MySql 版本为 5.0),名为 %COMPUTERNAME%.log 的文件包含已执行的命令。

If you're using MySql on Windows, there's a file located in C:\Program Files\MySQL\MySQL Server 5.0\data (assuming a C: drive for the installation target and MySql version 5.0), that is called %COMPUTERNAME%.log that contains the commands that have been executed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文