Where can I find the MySQL transaction log?

半城伤御伤魂 提交于 2019-12-18 10:59:15

问题


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.


回答1:


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




回答2:


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

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




回答3:


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.




回答4:


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

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



来源:https://stackoverflow.com/questions/3394132/where-can-i-find-the-mysql-transaction-log

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!