Mac homebrew安装mysql 忘记密码 如何修改

查找mysql进程,查看mysql安装路径

ps -ef | grep mysql

进入mysql安装路径 /usr/local/Cellar/mysql/8.0.11/bin (每个人可能不一样)

cd /usr/local/Cellar/mysql/8.0.11/bin

暂停mysql服务

./mysql.server stop

安全模式启动mysql

./mysqld_safe --skip-grant-tables &

进入mysql交互模式

mysql

flush privileges;
ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码';


image.png

注意:重启mysql

./mysql.server stop
./mysql.server start

你可能感兴趣的:(Mac homebrew安装mysql 忘记密码 如何修改)