list all databases associated with a reseller !!

furquan

Well-Known Member
Jul 27, 2002
473
4
168
Hello All :

I have a requirement from a reseller and he needs to know all the DB's associated with all his hosted accounts. he has some 100 account and i cannot go browsing each panel for the info.

How is it possible to get it via CLI or any available script ?

Any assistance please !!!
 

sirdopes

Well-Known Member
PartnerNOC
Sep 25, 2007
141
0
66
This can easily be done in bash. I am sure there are better ways but I would use something like the following:

for i in `grep OWNER=owername /var/cpanel/users/* -l | cut -d '/' -f 5`; do ls /var/lib/mysql/ | grep $i_ ; done

That should print out a list of all of the databases assuming that you are not using the new cpanel feature where the databases do not start with the user_.
 

furquan

Well-Known Member
Jul 27, 2002
473
4
168
Thanks sirdopes :

I'll have this run and will see how it goes :)