MySQL username prefix not being truncated

DanH42

Active Member
Sep 11, 2011
35
0
56
Bloomington, IL
cPanel Access Level
Root Administrator
I noticed recently one of our cPanel servers (v58) has stopped truncating usernames for database prefixes. This reduces the number of characters left for usernames to sometimes only a couple characters, and for longer usernames completely prevents the creation of MySQL users:


What could have caused this? How do I get the truncation back working the way it was?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,229
463
Hello,

This relates to the following change documented in the cPanel 56 Release Notes:

MariaDB username length
On servers that use MariaDB instead of MySQL, the following conditions apply:
  • Database usernames now can contain up to 47 characters.
  • MariaDB uses the entire cPanel account username and the underscore character ( _ ) as a database prefix on servers that use a database prefix.
  • The system no longer requires that the first eight characters of cPanel account usernames be unique among accounts that exist on the server.
However, the issue you have reported is not the behavior I see on a test system. You should be able to create longer database names and database usernames while maintaining the longer prefix. Check to see if the following directories exist on this system:

/var/lib/mysql/.ssh
/var/lib/mysql/.cpanel


If so, move these directories out of the way, and restart MySQL, via the following commands:

Code:
mkdir /home/backup-mysql
mv /var/lib/mysql/.ssh /home/backup-mysql/
mv /var/lib/mysql/.cpanel /home/backup-mysql/
/scripts/restartsrv_mysql
Let us know if this helps.

Thanks!
 

DanH42

Active Member
Sep 11, 2011
35
0
56
Bloomington, IL
cPanel Access Level
Root Administrator
Check to see if the following directories exist on this system:

/var/lib/mysql/.ssh
/var/lib/mysql/.cpanel
Neither of those directories exist in /var/lib/mysql, nor are there any other hidden directories.

In addition to the length issue, I'm also unable to grant new privileges to users created before v56:


In the image above, I'm trying to add grants for an old MySQL user called extremem_sso. Something is getting crossed somewhere, and cPanel is adding an additional prefix to the already-prefixed username, resulting in "extrememotors_extremem_sso" which isn't a real user. This happens whether I'm granting privileges on a newly created database or on one that has an old truncated prefix. Even if I can get the username length issue solved, this prefix mismatching is still going to be an issue.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,229
463
Neither of those directories exist in /var/lib/mysql, nor are there any other hidden directories.
Hello,

Could you open a support ticket using the link in my signature so we can take a closer look? You can post the ticket number here and I'll make sure the thread is updated with the outcome.

Thank you.
 

DanH42

Active Member
Sep 11, 2011
35
0
56
Bloomington, IL
cPanel Access Level
Root Administrator
After some great sleuthing by a couple cPanel support folks, it turns out the issue was related to a bug in the x3 theme, which we still used on all our servers. Switching an account over to Paper Lantern fixes both issues we were seeing.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,229
463
I'm happy to see the issue is now resolved. Thank you for taking the time to update this thread with the outcome. More information on converting accounts to the Paper Lantern theme is available on the following thread:

X3 is no more so need help in bulk Action

Thanks!