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

时间:2022-05-21 15:05:53

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

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

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

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

4 个解决方案

#1


10  

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).

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

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

但是无论如何,如果没有初始转储,在binlog打开之前是没有用的。我想如果你做了转储并且打开binlog -你不会问这样的问题:- s

#2


2  

http://dev.mysql.com/doc/refman/5.1/en/query-log.html

http://dev.mysql.com/doc/refman/5.1/en/query-log.html

http://dev.mysql.com/doc/refman/5.1/en/binary-log.html

http://dev.mysql.com/doc/refman/5.1/en/binary-log.html

#3


1  

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.

如果使用的是MySql在Windows上,有一个文件位于C:\Program Files\MySQL\MySQL Server 5.0 \数据(假设一个C:驱动器安装目标和MySql版本5.0),叫做% COMPUTERNAME %。包含已执行命令的日志。

#4


0  

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 <> where seq is a sequence number for subsequent log files (recommended to put your file name there, with explicit directory location).

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

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

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

#1


10  

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).

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

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

但是无论如何,如果没有初始转储,在binlog打开之前是没有用的。我想如果你做了转储并且打开binlog -你不会问这样的问题:- s

#2


2  

http://dev.mysql.com/doc/refman/5.1/en/query-log.html

http://dev.mysql.com/doc/refman/5.1/en/query-log.html

http://dev.mysql.com/doc/refman/5.1/en/binary-log.html

http://dev.mysql.com/doc/refman/5.1/en/binary-log.html

#3


1  

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.

如果使用的是MySql在Windows上,有一个文件位于C:\Program Files\MySQL\MySQL Server 5.0 \数据(假设一个C:驱动器安装目标和MySql版本5.0),叫做% COMPUTERNAME %。包含已执行命令的日志。

#4


0  

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 <> where seq is a sequence number for subsequent log files (recommended to put your file name there, with explicit directory location).

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

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

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