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!

How does cPanel handle username conflicts in MySQL?

Discussion in 'Database Discussion' started by kabatak, Jan 18, 2019.

  1. kabatak

    kabatak Well-Known Member

    Joined:
    Jun 10, 2009
    Messages:
    140
    Likes Received:
    6
    Trophy Points:
    68
    Cpanel creates MySQL username like this right:

    Cpanel username:
    foobaruser1
    MySQL username (first 8 chars):
    foobarus

    What if a new Cpanel username is created with identical first 8 chars? E.g.,

    New Cpanel username:
    foobaruser2

    What will be the MySQL username in this case?
     
  2. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,472
    Likes Received:
    505
    Trophy Points:
    263
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hello @kabatak


    They're completely separate so in theory, they could be the same user. There's a root mysql user as well as a root user. What's the context in which you're experiencing an issue?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. kabatak

    kabatak Well-Known Member

    Joined:
    Jun 10, 2009
    Messages:
    140
    Likes Received:
    6
    Trophy Points:
    68
    Hi cPanelLauren

    I made a typo, what I mean is MySQL database name instead of username.

    Going back to my example:

    Cpanel creates MySQL db names like this right:

    Cpanel username:
    foobaruser1
    MySQL db name (first 8 chars):
    foobarus_


    What if a new Cpanel username is created with identical first 8 chars? E.g.,

    New Cpanel username:
    foobaruser2

    What will be the MySQL db name in this case? Will it still be foobarus_?


     
  4. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,923
    Likes Received:
    177
    Trophy Points:
    343
    cPanel Access Level:
    Root Administrator
    You won't be able to create the foobaruser2 user. You'll get an error saying that the first 8 characters aren't unique on the system.

    ...

    This all really begs the question.... what's the point of having usernames longer than 8 characters? I've been asking that question for years.

    It's an example of cPanel's left hand not knowing what the right hand is doing.

    MariaDB (and maybe newer version of MySQL?) allow for the use of longer names. Removing the 8 character username limit made sense if everyone was using MariaDB and cPanel did not have to enforce this. But... not everybody is using MariaDB... and not everybody is using an up-to-date system... and not everyone has new users that were created today.

    So yea... if I had my druthers... I'd prefer cPanel to just restrict usernames to 8 characters on account creation. It makes the most sense. But the cat's already out of the bag with this one... so...

    Fore-thought... it's important.
     
  5. kabatak

    kabatak Well-Known Member

    Joined:
    Jun 10, 2009
    Messages:
    140
    Likes Received:
    6
    Trophy Points:
    68
    I see. I think that's an acceptable behavior.

    I share your sentiments but at least there's an error during conflict right on the Cpanel account creation part (and not during MySQL db creation).
     
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