由于最新版本的 MySql 更改了密码策略,所以相比于以前默认空密码的 root 来说,现在已经指定了默认密码,日志如下:
2017-08-31T01:49:12.188748Z 1 [Note] A temporary password is generated for root@localhost: uGikFbl#s5if 具体过程如下所示:打开终端进入(MySql 安装目录):
FSdeMacBook-Pro:local fs$ cd /usr/local/mysql/bin/使用 MySQL 登录命令: FSdeMacBook-Pro:bin fs$ ./mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 17 Server version: 5.7.13 MySQL Community Server (GPL) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> 进行密码重设: mysql> set password = password('ss'); Query OK, 0 rows affected, 1 warning (0.00 sec) 设置密码过期模式为不过期: mysql> alter user 'root'@'localhost' password expire never; Query OK, 0 rows affected (0.00 sec)更新存储:mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)