How does cPanel handle username conflicts in MySQL?

kabatak

Well-Known Member
Jun 10, 2009
148
8
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?
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,263
313
Houston
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?
 

kabatak

Well-Known Member
Jun 10, 2009
148
8
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_?


 

sparek-3

Well-Known Member
Aug 10, 2002
2,007
222
368
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.
 

kabatak

Well-Known Member
Jun 10, 2009
148
8
68
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.
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).