docker部署mysql80忘记密码了怎么修改
如果你在部署 MySQL 8.0 时忘记了密码,可以按照以下步骤修改密码:
-
停止 MySQL 服务:
sudo systemctl stop mysql -
以跳过权限验证的方式启动 MySQL 服务:
sudo mysqld_safe --skip-grant-tables & -
连接到 MySQL 服务器:
mysql -u root -
在 MySQL 提示符下,切换到
mysql数据库:use mysql; -
更新
root用户的密码:update user set authentication_string=password('new_password') where user='root';注意将
new_password替换为你想要设置的新密码。 -
刷新权限:
flush privileges; -
退出 MySQL 提示符:
quit; -
停止 MySQL 服务:
sudo systemctl stop mysql -
启动 MySQL 服务:
sudo systemctl start mysql
现在你应该可以使用新密码登录 MySQL 了
原文地址: http://www.cveoy.top/t/topic/iVnk 著作权归作者所有。请勿转载和采集!