0

I have two situations I need some clarification.

1) Let's say I made a backup of all the MySQL binary logs before I purged a single binary log file (the oldest one, possibly the very first one).

mysql-bin.000001

Can I restore this single binary log from the backup I made? Just copy and paste it from my backup to the MySQL data directory and I can use it again as if it was never deleted in the first place?


2) Another situation, let's say I purged every bin log except the current one but after a month or two I needed to restore something from the middle of the purged bin logs like:

mysql-bin.000099

Can I just restore this single file from backup and do whatever it is I need to get back from this bin single bin log file? Or I would need to restore everything before I could use that file?

3
  • Sounds like an X-Y problem. What goal are you trying to achieve by restoring log files?
    – mustaccio
    Commented Jun 16, 2019 at 17:03
  • I'm not trying to solve anything, I just want to know if this is possible to do. Maybe someone here has tried it already?
    – GoDesigner
    Commented Jun 16, 2019 at 18:38
  • Take a look though the official docs on binary log point in time recovery. Take a practice, at a backup. Its heaps better than just grasping the theory. As you can see the usage requires the file and a position from when it was taken.
    – danblack
    Commented Jun 17, 2019 at 4:44

1 Answer 1

1

The binlogs contain a chronological list of the changes made to all the tables. There is no "snapshot" in them, only insert, deleted, etc statements.

You can look at any one of the files with the mysqlbinlog program.

"get back from this bin single bin log file" -- What do you imagine you might want to get?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.