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