SymptomsWhile adding a database user for a database of any domain, the following error appears:
Error: Database user name is invalid.
CauseMost probably, the Database hosting settings were adjusted to add a client username prefix to the database user account as depicted below:
Thus, for the database username, there are only 10 characters left in accordance with MySQL username restrictions that are hard-coded by design. MySQL user name length is limited to 16 symbols by default. Therefore, in order to avoid any conflicts with MySQL database usernames product maintenance team, you must limit the length of the database account name to 10 symbols if the user prefix enabled. This leaves 6 remaining symbols for a possible prefix, including the underscore symbol.
However, if you input the type of field, the imitation is omitted, leaving 16 symbols to be entered:
With the prefix, 6+16=22 symbols, which is not correct for MySQL username policy. Therefore, Plesk shows the error message below:
ResolutionAs a workaround, you can disable the prefix in Home > Server Tools > Database Servers > Database hosting settings. Disabling the prefix will allow you to enter the full 16-characters for the username.
Otherwise, if you want to use a database user prefix, you should use names that are less or equal to 10 symbols in length. However, in this case, you can face another complication.