EN
MySQL - set root password
2
points
In this short article we would like to show how to set root
password in MySQL.
Requirements:
root
password 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:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new-root-password';
new-root-password
should be replaced with desired password.FLUSH PRIVILEGES;
Note: above solution were tested with MySQL 8.0.22 under Ubuntu 20.04.