1

Im researching the best way of logging queries in MySQL database. The log should be used for two things:

  1. Documentation of system activity
  2. Used to recreate the database (in case the database is hacked or otherwise corrupted)

It's possible to log all queries in a MySQL database (like this example)

Question: It is possible to recreate a database on the basis of the log file, or should I use a different approach?

Community
  • 1
  • 1
Vingtoft
  • 13,368
  • 23
  • 86
  • 135

1 Answers1

0

You can use replication logs for this - they store the complete set of operations. You should be able to create a new database from original sources and apply all changes upon it.

You can do complete dumps (i.e. once a week) and archive the replication logs on daily basis.

Boris Schegolev
  • 3,601
  • 5
  • 21
  • 34