Mac重置Mysql>8 root密码

新开一个终端运行

1, » sudo mysqld_safe --skip-grant-tables;

新开一个终端

1, » cd /usr/local/mysql/bin/

2, » ./mysql -u root -p

mysql> FLUSH PRIVILEGES;

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';

mysql> exit or Ctrl + z

重启Mysql服务器

$ sudo /usr/local/mysql/support-files/mysql.server stop

$ sudo /usr/local/mysql/support-files/mysql.server start

再次登陆即可进入

» mysql -u root -p