I am writing this info because I have run in to this problem a few times now and I am hoping you will be able to implement some strategy to stop others falling in to the same trap.
In Virtualmin when you create a virtual server the part of the virtual server before the first dot is used to create the database name and the database user in MySql. In MySql the database name can be char(64) or less but the user name can only be char(16) or less. Virtualmin seems (and I stress seems because I have not confirmed it just fixed the problem after it happens) to over ride the char(16) limit when creating the user name in MySql. Then when a MySql upgrade happens like just happened any username longer that char(16) is truncated to char(16) and there are problems.
For long virtual servers the MySql user name does not have to be more that the char(16), just we need to be made aware of the Mysql user name for databases. If you go to Virtualmin> Edit Databases> it shows the Database name, Database type and Action. I would suggest it would be very useful the have the database user name also listed on this page so you can see if it is different that the database name and limit the database user name to char(16).
This was also an issue in Ubuntu 8.04 and 10.04