MySQL v 5.7 or higher generates a temporary random password for the mysql root user after installation and stores that in the mysql log file that was created when you installed the package.  The log file is located at /var/log/mysqld.log at least that is the case with CentOS 7 and RHEL 7.

To see the password set by default when you installed the package:

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

To change the cryptic password to something you can remember, run this:


Mysql will prompt you for the pw.  At that point you are going to have to type the password in manually, cut and paste does not work – then follow the prompts.