The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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:
    425
    Likes Received:
    0
    Trophy Points:
    16
    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 !!!
     
  2. sirdopes

    sirdopes Well-Known Member
    PartnerNOC

    Joined:
    Sep 25, 2007
    Messages:
    141
    Likes Received:
    0
    Trophy Points:
    16
    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:
    425
    Likes Received:
    0
    Trophy Points:
    16
    Thanks sirdopes :

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

Share This Page