Rotating MySQL log tables

Posted on 2012-08-08

I use MySQL for logging. Here is a way to rollover a table named BigTable without downtime.

CREATE TABLE BigTableNew LIKE BigTable;
RENAME TABLE BigTable TO BigTable_Date, BigTableNew TO BigTable;

Tags: mysql logging