<?php
$usuario = 'root';
$senha = '';
$host = 'localhost';

$conn = new mysqli($host, $usuario, $senha);
if ($conn->connect_error) {
    die("Erro ao conectar: " . $conn->connect_error);
}

$result = $conn->query("SHOW DATABASES");

while ($db = $result->fetch_assoc()) {
    $banco = $db['Database'];
    if (in_array($banco, ['information_schema', 'mysql', 'performance_schema', 'sys'])) continue;

    echo "<h3>Banco: $banco</h3>";

    $conn->select_db($banco);
    $tables = $conn->query("SHOW TABLES");
    while ($t = $tables->fetch_array()) {
        $tabela = $t[0];
        $check = $conn->query("CHECK TABLE `$tabela`");
        while ($linha = $check->fetch_assoc()) {
            $msg = $linha['Msg_text'];
            echo "Tabela <strong>$tabela</strong>: $msg <br>";
        }
    }
}
?>
