In this short article we would like to show how to set
root password in MySQL.
rootpassword is not set yet - we have freshly installed MySQL Server.
- Login to MySQL console with:
- Pass to MySQL consolle following queries:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new-root-password';
new-root-passwordshould be replaced with desired password.
Note: above solution were tested with MySQL 8.0.22 under Ubuntu 20.04.