MariaDB Username Length Limit (max 16 chars)

SYSTEM INFORMATION
OS type and version Debian 13
Webmin version 2.630
Virtualmin version 8.1.0
Webserver version Apache 2.4.66
Related packages MariaDB 11.8.6

I know that MariaDB 10.x and later versions are supporting 80 character usernames. Because of virtualmin user creation works like USERNAME @ DOMAIN.TLD way, it almost always becomes longer than 16 characters. I’m getting login error while trying to connect database with full username. Is there a webmin/virtualmin config for allowing up to 80 characters?

Will you please give us the full error you are getting? While it MAY be length related we need to verify with the exact error you are seeing.

Do you happen to have a reference in the Mariadb docs covering the username limit and when it changed?

As I wrote in original post previously, there is no specific error. Simply I can’t reach database via using full username, but there is no problem if I’m using first 16 characters of the username. For example:

Original username: username@sub.domain.tld
because of this address is 23 char long, there is an sql error: Access denied for user ‘username@sub.domain.tld’@‘localhost’ (using password: YES)

but if I have used username@sub.dom instead, which is first 16 chars there is no problem and I can reach database

Nevermind, found it: CREATE USER | Server | MariaDB Documentation

We’ll make it support longer names. Looks like MySQL also has longer usernames in newer versions, but not the same length as Mariadb (30 and 32, depending on version). That stinks, but it can be handled.

Yes, and the latest line of that sections says “Usernames can be up to 80 characters long before 10.6 and starting from 10.6 it can be 128 characters long”

I just saw a post on another source which says MariaDB 10.x and newer support 80 characters as a user name

I’ve not using mysql for a very long time so I don’t know about it but mariadb surely supports up to 80 chars for a very long time

So, is there a way to change this limitation for now or should I need to wait for next virtualmin version releases?

I’ve made an issue for tracking development here: Mariadb and MySQL should allow longer usernames · Issue #2683 · webmin/webmin · GitHub

MariaDB itself supports longer usernames, but the limitation you’re hitting is usually on the client/authentication side or how Virtualmin formats the user (user@domain). There isn’t a specific Webmin/Virtualmin setting to “enable 80 characters” instead, you’ll need to shorten the username prefix in Virtualmin (or use a shorter domain alias) so the full MySQL/MariaDB username stays within limits expected by your client or connector. Also double check that your application and connection method support long usernames, since some older drivers/tools still assume the old 16-character limit.

Er, actually, there is a mysql_user_size somewhere in Virtualmin config already.

So, yes, you can change it, but I don’t see where to change it in the UI.

As far as I can tell, you can add that directive to the Virtualmin config file in /etc/webmin/virtual-server/config, it’ll look like this:

mysql_user_size=80

Then restart the webmin service.

I don’t know why this isn’t exposed in the UI, and I don’t know why we’re not defaulting to 32 (which is the minimum size supported by any Mariadb or MySQL version on any currently maintained OS), at this point, even if we don’t dynamically handle switching to 80 for Mariadb.

I actually found this issue after transfering one of my website from webmin 2.021 / virtualmin 7.5 server to webmin 2.630 / virtualmin 8.1 server.

Same website was working fine on older instance with long database usernames (which is 36 chars long btw)

There is a string on help panel in Edit Users > Edit User > Database access settings > Allow access to databases which says “MariaDB only supports usernames up to 16 characters long, so for a user with a long account name only the first 16 characters are needed when logging in to the database.” which is not true

I will try this fix thank you

mysql_user_size=80

fixed the issue, thank you.

I also checked the virtual-server/config file on old server and it already has this directive. I don’t know why newer installation don’t have it, also there is a similar directive mysql_user_size_auto=1 only on new server

Have you upgraded to Debian 13 from Debian 10 or lower?

You can safely set it to 128, as MariaDB 10.6 and later support it without issues.

See this:

No I have built new server from scratch. It’s fresh installation.

Just transferred website files via manual zipping and database as export from panel UI. Didn’t use migration tool

We’ll fix it in the next release. Thanks for the heads-up!

is Virtualmin/webmin getting a UI item for this setting?

No, not really. We don’t need that option. But if we make it depend on the config file for each OS, it could get a UI option in the Webmin MySQL/MariaDB module config.

yes, i agree. it sounds like it should be something that is a one off and made at the time of installation or in post install wizard. how often is anyone going to need to change this and what future problems is it going to generate by “experimenting”?