[Vestacp] Increase database username length limit

For so long mysql has a harcoded 16 characters length limit on username. And vestacp enforce this limitation, every database username have to be less than 17 characters long.

The problem is mysql has increase this length limit to 32 charcaters and mariadb even remove this limit completely but vestacp hadn’t lift their limit yet for the sake of compatibility. So, until this issue closed: https://github.com/serghey-rodin/vesta/issues/860, if you have mysql 5.7+ and want to make really long username, you have to change vesatacp’s code.

Open file /usr/local/vesta/func/main.sh

Find those line

 if [ 17 -le ${#1} ]; then
 check_result $E_INVALID "mysql username can be up to 16 characters long"
 fi

Now change the number 17 to 33 and you essentially double the username length limit.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.