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

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>