How to find unmapped databases?

stormy

Well-Known Member
Nov 22, 2003
223
44
178
Spain
cPanel Access Level
Root Administrator
Due to some problems in a migration, I've found that there are unmapped databases, as well as some missing databases too.

Is there a command I can run to find unmapped databases, or mapped but nonexistent databases?

I would like to crosscheck the databases that cPanel has mapped with the ones that actually exist in MySQL.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello,

There's no script or command available that will list databases that aren't associated with a cPanel account, however you can find a list of databases that are associated with cPanel accounts with a command such as:

Code:
whmapi1 list_databases
This WHM API 1 function is documented at:

WHM API 1 Functions - list_databases - Software Development Kit - cPanel Documentation

You'd need to manually compare this with the databases stored in the /var/lib/mysql/ directory to see which databases aren't associated with a cPanel account, or develop a custom script that cross-references the results.

Thank you.