Cannot grant mysql db access to user name longer than 32 chars

SYSTEM INFORMATION
OS type and version: ubuntu 20.04 server
Webmin version: 1.973
Virtualmin version: 6.16
Related products version: mysql 8.0

gui sequence produces:

Failed to save user : SQL drop user if exists 'user@domain'@'localhost' failed : String 'user@domain' is too long for user name (should be no longer than 32)

virtualmin modify-user --domain domain --user user --add-mysql database produces:

Error: SQL drop user if exists 'user@domain'@'localhost' failed : String 'user@domain' is too long for user name (should be no longer than 32)
Error
-----
SQL drop user if exists 'user@domain'@'localhost' failed : String 'user@domain' is too long for user name (should be no longer than 32)
-----

I can remember when the mysql limit was 16 characters. I don’t know how on earth you get around the 32 character limit. I also can’t imagine why anybody would need a user name 32 characters long.

i dont need a mysql username longer than 32 characters. i dont need a mysql username longer than 16 characters. the issue here is that the virtualmin username isnt being truncated.

Well, the title led me to believe that’s what you were trying to accomplish - using a name longer than 32 characters.

Something you might want to check: When I created a subdomain once for testing purposes it created a user with the same issue. The domain was something like testserver@exposingwot.com. What it did was create a user named testserver.exposingwot.com@testserver.exposingwot.com or something like that.

I can’t remember exactly how that happened or what I did to do it but that was what caused my error.

this is a top level server containing a user who has access to a db other than the automatic domain_tld db. it was created on and backed up from an ubuntu 16.04 server currently running webmin 1.979, virtualmin 6.15 and mysql 5.7.

im attempting migrate to new hardware and using these docs for the virtualmin back up/restore portion, but the resore part trips over the virtual server containing the aforementioned user/db.

Error: SQL drop user if exists 'user@doimain'@'localhost' failed : String 'user@domain' is too long for user name (should be no longer than 32)
Error
-----
SQL drop user if exists 'user@domain'@'localhost' failed : String 'user@domain' is too long for user name (should be no longer than 32)
-----

So then i tried to do it manually by disassociating the extra db from the virtual server on the first box, re-running its backup, restoring said virtual server on the new box, manually creating, restoring and importing the extra db, then failed with the initially reported error when assigning access to the db to user@domain.

im now hacking away at the virtualmin scripts to get around the issue, but its slow going given my complete lack of perl knowledge.

commenting out line #2898 from /usr/share/webmin/virtual-server/feature-mysql.pl (@rv = ("drop user if exists '$user'\@'$host'");) eliminates the drop user error and replaces it with:

Error: SQL grant all on `16-char-truncated-domain\_tld`.* to '16-char-truncated-domain'@'localhost' with grant option failed : You are not allowed to create a user with GRANT
Error
-----
SQL grant all on `16-char-truncated-domain\_tld`.* to '16-char-truncated-domain'@'localhost' with grant option failed : You are not allowed to create a user with GRANT
-----

but as the user is actually created despite the error, re-running the restore causes it to breeze past it on the second go. however, it then errors on the same bit for the virtual server’s second db:

Error: SQL grant all on `seconddb`.* to '32-char-truncated-user@domain'@'localhost' with grant option failed : You are not allowed to create a user with GRANT
Error
-----
SQL grant all on `seconddb`.* to '32-char-truncated-user@domain'@'localhost' with grant option failed : You are not allowed to create a user with GRANT
-----

despite the 32-char-truncated-user@domain user being created just like the previous, re-running the restore has no effect. instead it just errors out again.

rolled my vm back to a fresh install of virtualbox, manually created a db and a virtual server, imported said database to said virtual server and then attempted to create a user with access to the additional db. if the full user name (user@domain) adds up to more than 32 characters the SQL drop user if exists 'user@domain'@'localhost' failed : String 'user@domain' is too long for user name (should be no longer than 32) results.

lets see if this gets any official attention.

finally figured out how to migrate around all the issues…sort of.

  1. disassociate the additional db from the virtual server.
  2. backup and restore according to the docs.
  3. re-create the db in webmin.
  4. re-associate the db with the virtual server.
  5. create the virtual server user(s) intended for the additional database, making sure to keep them at 32 characters or less.
  6. restore your mysqldump file to the db.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.