where / what is the root password on mysql 5.7?

If you are facing issue like the root access denied and mysql_secure_installation doesn’t work after fresh install of mysql 5.7

the answer is … it wont work!

Check article from mysql documentation… https://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html

to cut the long story … the root password is randomly generated this time for 5.7 and can be found on the log file /var/log/mysqld.log!


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

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 'MyNewPass4!';