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.

Deleting a acount in cpanel does not delete the remote DB

Discussion in 'General Discussion' started by DWHS.net, Aug 31, 2007.

  1. DWHS.net

    DWHS.net Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,569
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    When I delete the account in cpanel it will not delete the remote database on the remote database server.

    I have to go in and manually remove each one which is very tricky since you don't always know for sure if the database is for a full account or a add-on.

    Any thoughts on how to streamline this?

    maybe a script to see what when the db was last accessed and remove it if it's a year old for example. :confused:
     
  2. DWHS.net

    DWHS.net Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,569
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    Anyone come up with a way to know which mysql accounts to delete on the remote mysql server?

    cpanel leaves all mysql DB on the remote server after the the account is deleted in cpanel. :confused:
     
  3. nilesh_kolte

    nilesh_kolte Well-Known Member

    Joined:
    Apr 13, 2006
    Messages:
    65
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Pune ,India
    cPanel Access Level:
    Root Administrator
    Hello,

    Please check the Database clustering for the servers. There seems to be a misconfiguration for remote database setup.
     
  4. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    What do you mean by "you don't always know for sure if the database is for a full account or a add-on" - I'm not understanding the 'add-on' part.

    AS for a work around to this, normal account termination will call /scripts/legacypostkillacct and /scripts/postkillacct /scripts/legacypostkillacct might be the easiest to use since the first argument passed to it is the name of the user account to terminate. Some quick, untested code that illustrates this:

    Code:
    #!/bin/bash
    
    set USER=$ARGV[0]
    
    mysql -h 192.168.0.1 -u root < "DROP DATABASE $USER"
    
    Granted, that's only going to delete the primary database of the user, not databases in the format user_dbname. Nor does it revoke privileges.
     
  5. DWHS.net

    DWHS.net Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,569
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    I can delete the databases fine manually, I just don't know if the account is still live without going to the main server and searching for the user name.

    There is a tool that checks the user names for cpanel on a server and removes backups for any accounts backup that does have a live username.

    I was hoping to find a way to tell on the remote mysql server if the database is for a live cpanel account or one that is removed.

    Otherwise to clean up the mysql server I have to check the database username and see if that username is live on the main server. This isn't bad other then their being about 5k databases on the server.
     
  6. DWHS.net

    DWHS.net Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,569
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    Maybe there is way to check when the databases was last accessed? Someway in a bulk method on the mysql server.
     
  7. DWHS.net

    DWHS.net Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,569
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    I really wish cpanel would fix this or find a way to list the databases not being used anymore on remote mysql servers.
     
  8. jdhf99

    jdhf99 Well-Known Member

    Joined:
    Mar 16, 2004
    Messages:
    54
    Likes Received:
    0
    Trophy Points:
    6
    I'm also having the same problem, a solution would be nice :)
     
Loading...

Share This Page