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!

SOLVED Username Length Limits

Discussion in 'General Discussion' started by osirion, Jun 8, 2018.

  1. osirion

    osirion Well-Known Member

    Joined:
    Jan 16, 2007
    Messages:
    50
    Likes Received:
    4
    Trophy Points:
    158
    Hi Guys,
    So cPanel used to have an 8 char limit on the usernames and this then got changed (to 16 characters I believe) - which is great. However, this brings another issue because MySQL usernames and database names were left at 16 characters.
    This means if one creates a user with a long username, there is no space left for MySQL and then it just gives errors when trying to create users / db's.

    I created a user recently, and cpanel automatically gave me a username based off the domain name (purpose of this demonstration, domain is 123456guestrooms.com and the username was 123456guestrooms).
    I just got errors when trying to create MySQL users / db's and eventually figured this out - then just recreated the account with a smaller username (123456) and bob's your uncle - it worked.

    So, in short:
    Account username 16 char limit
    MySQL username / database = 16 char limit
    If account username = 16 char limit; then there are no characters left to create database users / database names.
    Shouldn’t the account username limit be 14 characters so there is at least space for and under score and 1 character? Or, preferably, and from my understanding, MySQL now supports 32 characters so just update the mysql 16 character limit to 32?
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,423
    Likes Received:
    1,958
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @osirion,

    I've been unable to reproduce the issue you described using the following steps:

    1. Created an account cptest1234567890123.tld with username cptest1234567890.
    2. Browsed to cPanel >> MySQL Databases and confirmed only the first eight characters of the username are utilized for the database prefix.
    3. Attempted to create a second account using cptest12345678901234.tld with username cptest1234567891 and confirmed it was correctly forbidden with the following error message:

    Can you verify which version of cPanel & WHM is installed on your system, and which version of MySQL is installed?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,798
    Likes Received:
    131
    Trophy Points:
    343
    cPanel Access Level:
    Root Administrator
    This is another classic example of a real head scratcher for me.

    You can use a 16 character system username in cPanel... but the first 8 characters can't be shared with another system user. ... So... what's the point of having >8 character usernames? Never got a firm answer to that.

    It is my understanding that MariaDB allows for longer database usernames. So this made sense if cPanel was moving towards MariaDB and would eventually drop the first 8 character uniqeueness requirement, but that never happened. And that was a long time ago. I'm not sure if cPanel is still moving towards MariaDB (they seem to be back to supporting MySQL as well - and perhaps newer versions of MySQL don't have this username restriction).

    So yea, this was always a real head-scratcher for me. It was really fun explaining it to clients "No you can't use that username, even though that username is not used on the server, the first 8 characters of that username is used by another username."
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,423
    Likes Received:
    1,958
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @sparek-3,

    This limit is imposed because MySQL itself historically limited the database username to 16 characters. Thus, let's say cPanel usernames were permitted to share the first 15 characters and database prefixing was enabled. At that point, the likelihood of cPanel users encountering database user creation errors would increase significantly since MySQL doesn't permit duplicate database names or database usernames.

    Since MariaDB limits the database username to 47 characters, the first eight characters of a username do not have to be unique when creating a cPanel account on a server using MariaDB.

    With that said, a feature request to enable or disable the requirement for the first eight characters of the cPanel username to be unique isn't a bad idea, especially now that MySQL version 5.7 is offered and allows 32 characters:

    Submit A Feature Request

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,798
    Likes Received:
    131
    Trophy Points:
    343
    cPanel Access Level:
    Root Administrator
    Yea, I get that... but this begs the question: Why did cPanel increase their username limit to 16 characters if you were still going to be hampered with the MySQL limit?
     
  6. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,423
    Likes Received:
    1,958
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    The addition of the Require a username prefix on names of new databases and database users feature under the SQL tab in WHM >> Tweak Settings provided a way for server administrators to let cPanel users create databases and database usernames without the username prefix. Thus, a 16-character cPanel username wouldn't interfere with the ability to create MySQL users and databases.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,798
    Likes Received:
    131
    Trophy Points:
    343
    cPanel Access Level:
    Root Administrator
    And that was a well thought out idea because... ?

    Someone's going to create a database username of wordpress and then someone else is going to wonder why they can't use wordpress as their database username.

    In my humble opinion, this was all an exercise in cPanel trying too hard. Somebody wanted a longer username and instead of telling them no and explaining why, you caved and added that functionality into the system when the system just wasn't ready for it.

    It's all water under the bridge now. But it's also a learning experience. You don't have to cave in to every little feature request. It's a whole lot easier to say no when a feature isn't ready than spending resources with every new version trying to fix the usability of an ill-advised feature.
     
  8. osirion

    osirion Well-Known Member

    Joined:
    Jan 16, 2007
    Messages:
    50
    Likes Received:
    4
    Trophy Points:
    158
    Ok, I think we're getting off track here with the original issue at hand :P

    @cPanelMichael - I'm using v70.0.48 of cPanel and Currently installed: 10.0.35-MariaDB

    It happened with two users so it wasnt a once off. With the one user, I removed him and re-added with a smaller username. with the second user, the username was small enough to at least have an underscore and 2 characters - so I went with that.
    Should I open a ticket for you to investigate further?

    Error log still showing the errors from the failed Wordpress installs because of the above mentioned reason; but worked when I ended up setting up the db's and users manually and then doing a manual install of WP
     
    #8 osirion, Jun 9, 2018
    Last edited: Jun 9, 2018
  9. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,423
    Likes Received:
    1,958
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @osirion,

    Yes, please open a support ticket so we can take a closer look at what you are describing. You can post the ticket number here once it's opened.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. osirion

    osirion Well-Known Member

    Joined:
    Jan 16, 2007
    Messages:
    50
    Likes Received:
    4
    Trophy Points:
    158
    @cPanelMichael - Ticket created: 9720675
    Just remember that as per the ticket, the best example of this is stated in the ticket, but I deleted said user and created it again with a smaller username.
     
    cPanelMichael likes this.
  11. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,423
    Likes Received:
    1,958
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    To update, it looks like the update from MySQL 5.6 to MariaDB 10.0 did not finish successfully on the affected system system. The mysql_upgrade command did not run cleanly, and thus the username limit defined in the mysql.user table still showed 16 characters. Upon successfully running the mysql_upgrade command on the affected system, the username limit was updated to the MariaDB limit of 80 characters.

    Thank you.
     
    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