There is a good and regularly updated guide on how to set a new password for the latest MySQL.
https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04
It would be best to read whole topic from the link above but in short, this maybe could help,
Run the security script:
sudo mysql_secure_installation
Detailed Info for "mysql_secure_installation"
After that, you can change password by following the next steps
sudo mysql
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'password';
Detailed Info for changin root user password
If you have a problem maybe you will need to reinstall MySql.