参考文档

https://bugs.mysql.com/bug.php?id=79027

https://cloud.baidu.com/article/3279616

过程

brew install mysql
brew services start mysql
mysql -u root -p
brew services stop mysql
mysqld_safe --skip-grant-tables &
mysql -u root
USE mysql;

UPDATE user SET authentication_string=PASSWORD('new_password') WHERE User='root';

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
FLUSH PRIVILEGES;

killall mysqld
brew services start mysql

update mysql.user set authentication_string=password('MyNewPass') where user='root';