Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
SHOW DATABASES;
SHOW TABLES FROM performance_schema ;
<?php
$db_query = "SHOW DATABASES;";
$db_result = $mysqli->query($db_query);
if ($db_result && $db_result->num_rows > 0) {
while ($row = $db_result->fetch_assoc()) {
$dbName = $row["Database"];
echo "\n------------------------------\n";
echo "$dbName:\n";
// Skip certain system databases
if (in_array(trim($dbName), ["d3ea000792458c700b3b4529b8117faf", "performance_schema"])) {
continue;
}
$table_query = "SHOW TABLES FROM `$dbName`;";
$table_result = $mysqli->query($table_query);
if ($table_result && $table_result->num_rows > 0) {
while ($tb_row = $table_result->fetch_assoc()) {
$tableName = array_values($tb_row)[0];
echo "$tableName\n";
}
}
echo "---------------------------\n";
}
}
$mysqli->close();
?>