步骤
停止mysql服务
进入mysql安全模式
mysqld_safe –skip-grant-tablesmysql -u root -p
use mysql;
describe user;
update user set authentication_string= password(‘123456’) where user=’root’;
flush privileges;
重启mysql
题外话:mac为当前用户配置mysql环境变量
vim ~/.bash_profile
export PATH=$PATH:/usr/local/mysql-5.7.17-macos10.12-x86_64/bin
source .bash_profile