1:苹果->系统偏好设置->最下边点mysql 在弹出页面中 关闭mysql服务
2: Start it in safe mode
进入终端
输入:
cd /usr/local/mysql/bin/
回车后 登录管理员权限
sudo su
回车后输入以下命令来禁止mysql验证功能
./mysqld_safe --skip-grant-tables &
3) Open another terminal and run the following command (Keep last terminal open)
mysql -u root
4) Run the following command with suitable new password on the mysql console
mysql > UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
5) mysql > FLUSH PRIVILEGES;
6) Quit from both terminals and open new terminal and connect to mysql with root user and new password
mysql -uroot -p