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