╰─➤ mysql -V mysql Ver 8.0.33 for macos13.3 on arm64 (Homebrew) mysql.server status mysql.server stop skip-grant-tables 启动mysql ─➤ /opt/homebrew/Cellar/mysql/8.0.33_3/bin/mysqld_safe --skip-grant-tables 2023-07-21T07:00:37.264746Z mysqld_safe Logging to '/opt/homebrew/var/mysql/M1os.err'. 2023-07-21T07:00:37.374216Z mysqld_safe Starting mysqld daemon with databases from /opt/homebrew/var/mysql mysql -uroot 清空root密码 mysql> UPDATE mysql.user SET authentication_string=null WHERE User='root'; mysql> flush privileges; mysql> exit; 更新密码 mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'yourpasswd'; mysql> flush privileges; mysql> exit; root'@'localhost' 指定了要修改的用户为 root 用户,并且限定了该用户只能从本地主机登录。IDENTIFIED WITH caching_sha2_password 是指定了验证插件为 caching_sha2_password,一种密码验证插件 参考 macos上 mysql 8.0 重置密码记录