Cannot login to MySQL database after fresh install with root ID and empty/no password like other older MySQL versions do
In my case the data directory was automatically initialized with the --initialize-insecure
option. So /var/log/mysql/error.log
does not contain a temporary password but:
[Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
What worked was:
shell> mysql -u root --skip-password
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
Details: MySQL 5.7 Reference Manual > 2.10.4 Securing the Initial MySQL Account