Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

list all databases associated with a reseller !!

Discussion in 'General Discussion' started by furquan, Aug 23, 2010.

  1. furquan

    furquan Well-Known Member

    Joined:
    Jul 27, 2002
    Messages:
    471
    Likes Received:
    4
    Trophy Points:
    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 !!!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. sirdopes

    sirdopes Well-Known Member
    PartnerNOC

    Joined:
    Sep 25, 2007
    Messages:
    141
    Likes Received:
    0
    Trophy Points:
    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_.
     
  3. furquan

    furquan Well-Known Member

    Joined:
    Jul 27, 2002
    Messages:
    471
    Likes Received:
    4
    Trophy Points:
    168
    Thanks sirdopes :

    I'll have this run and will see how it goes :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice