1:苹果->系统偏好设置->最下边点mysql 在弹出页面中 关闭mysql服务mysql
2: Start it in safe modesql
进入终端ui
输入:spa
cd /usr/local/mysql/bin/code
回车后 登陆管理员权限ip
sudo suterminal
回车后输入如下命令来禁止mysql验证功能it
./mysqld_safe --skip-grant-tables &console
3) Open another terminal and run the following command (Keep last terminal open)table
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