╰─➤ 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
文章来源地址https://www.toymoban.com/news/detail-607429.html
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 重置密码记录
文章来源:https://www.toymoban.com/news/detail-607429.html
到了这里,关于macOS mysql 8.0 忘记密码的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!