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.

Create Database with underscore in the name

Discussion in 'General Discussion' started by cycletourist, Oct 30, 2009.

  1. cycletourist

    cycletourist Member

    Joined:
    Mar 20, 2003
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    I can not seem to get cPanel to let me create a database with an underscore in the name.

    I know about the username scheme, but what I would like to do is create a database name like dbase_name, so that what is created is username_dbase_name. When I do, cPanel says it created the database, but when I go back to the databases page, it is not there. No error message, but no database, so I assume it actually failed.

    Is there any way to put an underscore in the database name?
     
  2. kbuser

    kbuser Well-Known Member

    Joined:
    Aug 25, 2008
    Messages:
    66
    Likes Received:
    2
    Trophy Points:
    8
    All of our databases follow a similar format to what you're trying to do.

    What you'll want to try is generating the SQL for the database you'd like to create and add a call to the SQL in /scripts/postwwwacct (runs after an account is created).

    So
    $user = $OPTS{'user'};
    Will get the account name.

    Simply pass that to the function you create that makes the database.
     
  3. kbuser

    kbuser Well-Known Member

    Joined:
    Aug 25, 2008
    Messages:
    66
    Likes Received:
    2
    Trophy Points:
    8
    An after thought:

    Did you try checking the phpMa page as root to see if the database showed up there?
     
  4. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Only alphanumeric characters (letters and numbers) may be entered for the database name. In cPanel version 11.25 the behavior is corrected to better validate input for the database name, specifically displaying a message like the following when an underscore is entered:
    Code:
    Database name must be alphanumeric characters
     
  5. cycletourist

    cycletourist Member

    Joined:
    Mar 20, 2003
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Thanks for the suggestions, but I don't have root access.
     
  6. cycletourist

    cycletourist Member

    Joined:
    Mar 20, 2003
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Thanks for making that perfectly clear. Now I can quit trying to figure out how it might be done (escaped somehow?).

    A clear error message would be a good thing, but I'm confused. My cPanel says: cPanel Version 11.25.0-CURRENT 40255, yet it simply tells me:

    Database Created
    Added the database dbase_name.

    As to not being able to use an underscore, I guess it's not a simple thing for cPanel to separate the significance of the first underscore from succeeding ones.

    Thanks for the reply,
    Chuck
     
  7. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    What cPanel theme and style was used when entering in the database name? (e.g., x3 with the default style, or a third-party theme)

    I used EDGE when testing initially, but I re-tested this time using CURRENT; the following two builds were used:
    11.25.0-EDGE_40716
    11.25.0-CURRENT_40255

    When testing CURRENT using x3 and the default style, it displayed the same message. Of many, here is one of the example strings entered: "ab1_cd2" (does not include the account username) -- this resulted in the following message: "Database name must be alphanumeric characters."
     
  8. cycletourist

    cycletourist Member

    Joined:
    Mar 20, 2003
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    From cPanel:
    cPanel Version 11.25.0-CURRENT 40255
    Theme cPanel X v2.6.0

    I use bluelagoon everywhere. I like (or am used to) the appearance. It must be third party (and outdated), though, as I just switched to x3 and now I see the error message just as you say. I also see some features I've not seen before (MySQL Database Wizard, for one). Guess I'll switch over on all my cPanel accounts.

    Thanks for you assistance and your patience.

    Chuck
     
    #8 cycletourist, Nov 2, 2009
    Last edited: Nov 2, 2009
  9. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    While the bluelagoon theme is deprecated, it lives on in a x3 style after the same name; the bluelagoon x3 style happens to be what I used when testing on EDGE earlier (as I'm also fond of the bluelagoon appearance).

    Here is our documentation for more information on how to change the style (while logged-in as the user in cPanel):
    OtherFeatures < AllDocumentation/CpanelDocs < TWiki

    The menu path in cPanel is as seen below:
    cPanel: Preferences >> Change Style

    It's also possible to set the bluelagoon style as the default style using the Branding Editor via the WHM control panel; here is our related documentation detailing this further:
    Branding < AllDocumentation/CpanelDocs < TWiki

    Here is the menu path in WHM to locate where to set a new default style:
    WHM: Main >> cPanel >> Branding >> x3 [edit live]
    * Once on the above page (after clicking the edit live link), look for your preferred style and click "Set Default for New Accounts" to set it as the new default, or click "Apply to All Accounts" to have it be applied immediately to all accounts.
     
Loading...

Share This Page