Если у Вас имя базы другое, то надо будет ascent сменить на имя Вашей базы, где хранится таблички.
Код
#Команда на удаление аккаунтов, которые не использовались или на которых нет персонажей.
DELETE FROM `ascent`.`accounts` where `acct` not in (select acct from `ascent`.`characters`);
Код
# Удаление персонажей у которых нет аккаунтов. Удаление всех связей с удаленными персонажами.
DELETE FROM `ascent`.`characters` where `acct` not in (select acct from `ascent`.`accounts`);
DELETE FROM `ascent`.`corpses` where `guid` not in (select guid from `ascent`.`characters`);
DELETE FROM `ascent`.`guild_banklogs` where `player_guid` not in (select guid from `ascent`.`characters`);
DELETE FROM `ascent`.`guild_data` where `playerid` not in (select guid from `ascent`.`characters`);
DELETE FROM `ascent`.`guilds` where `leaderGuid` not in (select guid from `ascent`.`characters`);
DELETE FROM `ascent`.`instances` where `creator_guid` not in (select guid from `ascent`.`characters`);
DELETE FROM `ascent`.`mailbox` where `player_guid` not in (select guid from `ascent`.`characters`);
DELETE FROM `ascent`.`mailbox` where `sender_guid` not in (select guid from `ascent`.`characters`);
DELETE FROM `ascent`.`playercooldownitems` where `OwnerGuid` not in (select guid from `ascent`.`characters`);
DELETE FROM `ascent`.`playercooldownsecurity` where `OwnerGuid` not in (select guid from `ascent`.`characters`);
DELETE FROM `ascent`.`playeritems` where `ownerguid` not in (select guid from `ascent`.`characters`);
DELETE FROM `ascent`.`playerpets` where `ownerguid` not in (select guid from `ascent`.`characters`);
DELETE FROM `ascent`.`playerpetspells` where `ownerguid` not in (select guid from `ascent`.`characters`);
DELETE FROM `ascent`.`playerpetspells` where `ownerguid` not in (select guid from `ascent`.`characters`);
DELETE FROM `ascent`.`playersummonspells` where `ownerguid` not in (select guid from `ascent`.`characters`);
DELETE FROM `ascent`.`questlog` where `player_guid` not in (select guid from `ascent`.`characters`);
DELETE FROM `ascent`.`social` where `guid` not in (select guid from `ascent`.`characters`);
DELETE FROM `ascent`.`tutorials` where `playerId` not in (select guid from `ascent`.`characters`);