MySQL 5.7 第一次啟動時會產生一個臨時密碼, 放在 /var/log/mysqld.log
grep password /var/log/mysqld.log
就可以看到這一行
[Note] A temporary password is generated for root@localhost: xxxxxxxxxxxx
用 root 登入後再改密碼
set password=password('xxxxxxxxxxxx');
或
ALTER USER 'root'@'localhost' IDENTIFIED BY 'xxxxxxxxxxxx';