mysql8重置密码(brew安装)

  1. 在/opt/homebrew/etc下修改my.cnf,增加一行
skip-grant-tables
  1. 重启mysql

  2. 进入mysql,直接回车不用输入密码

mysql -u root -p
  1. 刷新权限(一定要)
flush privileges;
  1. 修改密码
use mysql;
alter user'root'@'localhost' IDENTIFIED BY 'Root@123';
// 授权外网访问
update user set host='%' where user='root';
  1. 删除my.cn中加的那一行,重启mysql
posted on 2022-07-20 08:57  小朱配齐  阅读(204)  评论(0编辑  收藏  举报