Could not set Mysql root password during installation

From Mysql version 5.7 onwards, we cannot log in as root to start with or cannot use 'mysqld_safe' to start mySQL to reset the root password.

This is because a superuser account 'root'@'localhost' is created at the installation time. A password for the superuser is set and stored in the error log file. To reveal it, use the following command:

#grep 'temporary password' /var/log/mysqld.log

Collect the root password from this log and reset it to a new strong password.

#mysql -uroot -p

#mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';


That's all.....

Leave a Reply