Prova questo:
mysql -u root -h 127.0.0.1 -p
Enter password: (enter the random password here)
Rif:https://dev.mysql .com/doc/refman/5.7/en/data-directory-initialization-mysqld.html
Successivamente, puoi reimpostare la tua password utilizzando ALTER USER 'root'@'localhost' IDENTIFIED BY 'new-password';