What is the default root pasword for MySQL 5.7

前端 未结 13 1155
梦谈多话
梦谈多话 2020-12-22 16:55

Cannot login to MySQL database after fresh install with root ID and empty/no password like other older MySQL versions do

13条回答
  •  囚心锁ツ
    2020-12-22 17:53

    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

提交回复
热议问题