MySQL 5.7之后,刚初始化的MySQL实例要求先修改密码。否则会报错:
mysql> create database test;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
所以修改下密码就OK:
alter user root@localhost identified by 'P@ssword1!';
flush privileges;