How to change the root password by using the default password
suggest changeTo reveal the default “root” password:
shell> sudo grep 'temporary password' /var/log/mysqld.log
Change the root password as soon as possible by logging in with the generated temporary password and set a custom password for the superuser account:
shell> mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass5!';
Note: Official MySQL 5.7 and 8.0 packages often install the validate_password component. Its default MEDIUM policy requires at least eight characters, with one uppercase letter, one lowercase letter, one digit, and one special character. Other installs may not load it. The temporary password itself is only for the first login.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents