[root@123 mysql]# grep 'password' /var/log/mysqld.log |head -n 1 2017-06-17T02:01:01.026946Z 1 [Note] A temporary password is generated for root@localhost: XqWlxlV3p.a8 [root@junqi mysql]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 31169 Server version: 5.7.18