How to change the root password by using the default password

suggest change

To 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.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents