Enumerate MySQL table

If you have a table "tablename" with a (non-PK) column "number" and you want to enumerate all existing rows starting with 1000 you can use the following SQL statement:

SET @n = 999;
DROP TABLE IF EXISTS `tablename_tmp`; 
CREATE TEMPORARY TABLE `tablename_tmp` (`tmpid` INT PRIMARY KEY, `n` INT);
INSERT INTO `tablename_tmp` SELECT `id`, @n := @n + 1 FROM `tablename`;
UPDATE `tablename` SET `number` = 
    (SELECT `n` FROM `tablename_tmp` WHERE `tmpid` = `id`);
DROP TABLE `tablename_tmp`;

Encrypted files with Flexbackup

Flexbackup is a very nice and flexible tool to create full, incremental and differential backups. But if you store your backups in an untrusted environment you might want do encrypt the created archive files. Flexbackup cannot handle it by default, but there is a very simple way to get the desired results by replacing the default gzip binary with a wrapper file.