MySQL – How to Flush/Clean ib_logfile0 and ib_logfile1

innodblogsMySQL

Is there a way to flush ib_logfile0 and ib_logfile1 without dumping the tables to a .sql file, deleting, then re-inserting? Somebody entered a couple plain text credit card numbers into the customer notes table. It came up in my PCI scan and I removed them from the table but they still exist in the log files 🙁

Best Answer

There are two ways

  1. Stop MySQL gracefully. Check the error log and make sure it was a normal shutdown.

    Move ib_logfile0 and ib_logfile1 out of the datadir (Save them just in case you need to roll back)

Start MySQL. InnoDB will notice there are no REDO log files and will create empty ones.

  1. Write to some InnoDB table some junk records until InnoDB rotates writes in ib_logfile* .