Generating a password that matches the Password Validation Component MySQL 8 has a pretty sophisticated "Password Validation Component" (this replaces the validate_password plugin). It has a lot of options,


validate_password.number_count
validate_password.mixed_case_count
validate_password.special_char_count
validate_password.dictionary_file
validate_password.length


Given that these can all be set by the user, is there mechanism guaranteed to generate a random password that satisfies this? Is the only way to write a UI that changes the password to suspend the validation component when you set it?
To generating random password for user while creating new one you can use : 


mysql&gt; CREATE USER ran_user@localhost IDENTIFIED BY RANDOM PASSWORD;
+----------+-----------+----------------------+
| user     | host      | generated password   |
+----------+-----------+----------------------+
| ran_user | localhost | UN:5_z05J._*VtU3K%Qu |
+----------+-----------+----------------------+
1 row in set (0.10 sec)



For altering password of current/existing user you can use this statement : 

mysql&gt; ALTER USER ran_user@localhost IDENTIFIED BY RANDOM PASSWORD;
+----------+-----------+----------------------+
| user     | host      | generated password   |
+----------+-----------+----------------------+
| ran_user | localhost | (YU&gt;{}tu&amp;6@[U%!Pdw&gt;n |
+----------+-----------+----------------------+
1 row in set (0.16 sec)


This RANDOM PASSWORD keyword satisfies password validator component :

mysql&gt;  show global variables like '%validate%';
+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password.check_user_name    | ON     |
| validate_password.dictionary_file    |        |
| validate_password.length             | 8      |
| validate_password.mixed_case_count   | 1      |
| validate_password.number_count       | 1      |
| validate_password.policy             | MEDIUM |
| validate_password.special_char_count | 1      |
+--------------------------------------+--------+
7 rows in set (0.23 sec)