╰─? mysql -V
mysql Ver 8.0.33 for macos13.3 on arm64 (Homebrew)
mysql.server status
mysql.server stop
skip-grant-tables 啟動(dòng)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
文章來(lái)源地址http://www.zghlxwxcb.cn/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 用戶,并且限定了該用戶只能從本地主機(jī)登錄。 -
IDENTIFIED WITH caching_sha2_password
是指定了驗(yàn)證插件為 caching_sha2_password,一種密碼驗(yàn)證插件
參考
- macos上 mysql 8.0 重置密碼記錄
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-607429.html
到了這里,關(guān)于macOS mysql 8.0 忘記密碼的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!