Skip to content

Instantly share code, notes, and snippets.

@tamr
Created August 25, 2019 03:08
Show Gist options
  • Save tamr/e5f3f521e427c82f8aaf3de9298c47d7 to your computer and use it in GitHub Desktop.
Save tamr/e5f3f521e427c82f8aaf3de9298c47d7 to your computer and use it in GitHub Desktop.
[Warning] ./db/table.frm is inconsistent: engine typecode 44, engine name ROCKSDB (45)
<?php
$di = new RecursiveDirectoryIterator('/var/lib/mysql/', FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_SELF | FilesystemIterator::SKIP_DOTS);
foreach (new RecursiveIteratorIterator($di) as $item => $file) {
if ($file->getExtension() !== 'frm') continue;
$content = file_get_contents($file->current()->getPathname());
$content = substr(implode(unpack("H*", $content)), 0, 8);
if ($content != 'fe010a2c' && $content != 'fe010b2c') continue;
$fp = fopen($file->current()->getPathname(), "r+");
fseek($fp, 0x3);
$patch = pack("N*", 0x2d120056);
fwrite($fp, $patch);
fclose($fp);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment