mac download mysql command: brew install mysql
check mysql version : brew list mysql
sudo mysql.server stop # 先关闭正常的MySQL服务sudo mysqld_safe –skip-grant-tables #跳过MySQL认证
sudo mysql -u root -p #提示密码时,直按按ENTER就能进入mysql命令行
mysql>use mysql;
mysql>update user set authentication_string=password(‘newpassword’) where user=‘root’;
mysql>exit;sudo mysql.server start #再次启动MySQL服务,就可以使用新密码正常登陆了