Search code examples
mysqlbinary-logmysqlbinlog

Mysql data recovery using mysqlbinlog


I accidentally dropped a schema without backing it up.

And now I want to use mysqlbinlog utility to perform recovery. (It seems that mysqlbinlog is a good tool). And it needs those binary log files to perform recovery.

Now I have the following confusions:

  1. I can not find those binary log files. So where are they located?
  2. If the operations are not logged or binary logging is not enabled, how to enable it. I have read the mysql documentation, it says they are enabled as default. But I cannot find those files,though...
  3. Is it possible to recover the data and schema through the /var/log/mysqld.log file

Solution

  • If you have the line log = /path/to/mysql.log uncommented in my.cnf, the queries will be in the mysql.log. That is, answering the third question.