PHP 7.4 & MySQL: caching_sha2_password Denying long (20c) passwords
Use this script to automatically set random length and content password, then reconnent to mysql server.
$mysqli = new mysqli('localhost', 'username', 'initialpassword', 'dbname');
$i=0;
while (true) {
if($i!=0){
$mysqli = new mysqli('localhost', 'username', $pw, 'dbname');
}
$pw = bin2hex(random_bytes(rand(1, 16)));
$successd = $mysqli->query("ALTER USER 'username'@'localhost' IDENTIFIED WITH caching_sha2_password BY '{$pw}'");
echo "times:{$i} pw:{$pw} {$successd}\n";
$i++;
}
In my environment there's not a single access denied error occurred after iterate 1 million times.