首页 > 编程知识 正文

mysql -u root -p,root用户密码忘记

时间:2023-05-05 12:40:49 阅读:138455 作者:3501

MYSQL8.0忘记Root密码:1.用超级管理员打开cmd,退出mysql服务2 .跳过权限验证登录mysql3。 在新窗口中登录mysql4。 切换到mysql,清空密码。 5 .设置加密规则,更新新密码,授权6 .设置成功后,重新启动mysql服务,使用新密码例外: authenticationplugin ' caching _ sha2_ password ' configuration

1 .在超级管理员中打开cmd并退出mysql服务

右键单击窗口S10左下角的win徽标,然后选择“管理员”

如果未设置环境变量,则必须切换到mysql安装目录并关闭mysql服务。

输入net stop mysql

2 .跳过权限验证登录mysql输入: mysqld---shared-memory---skip-grant-tables

此时,命令提示符已被锁定。 用管理员权限重新打开新的命令提示窗口。

3 .在新窗口中使用mysql命令:登录mysql -uroot -p,不输入密码直接回车即可。

切换到mysql,清空密码。 use mysql; updateusersetauthentication _ string=' ' where user=' root '; 将authentication_string留空。

然后,更新权限: flush privileges;

5 .设置加密规则并更新新密码,以更新alter user ' root ' @ ' localhost ' identified by ' abc123456 ' passwordexpirenever; 警报用户' root ' @ ' localhost ' identified by ' abc123456 '; gantallprivilegeson *.* to ' root ' @ ' localhost '; flush privileges;

在此强调,由于许可证需求不是第一次安装,因此重置密码可能会导致原始权限失效。 例如,我在登录后,使用use mysql提示我没有权限。 以后无法创建用户,即使与Navicat的连接失败也无法修改。

6 .成功配置后,重新启动mysql服务,然后使用新密码登录并重新启动服务,也需要以管理员身份运行cmd。 不这样做的话,就没有权限。

异常:授权‘caching _ sha2_ password’cannotbeloaded使用Navicat连接报告错误:授权’caching

加密规则,更新用户密码即可。

alter user ' root ' @ ' localhost ' identified by ' abc123456 ' passwordexpirenever; alter user ' root ' @ ' localhost ' identifiedwithmysql _ native _ password by ' abc123456 '; flush privileges;

themysqlserverisrunningwiththe---- skip-grant-tables error 1290 (hy 000 ) ) ) ) ) ) ) ) skip-grant-tables error 1290 ) 在nsoitcannotexecutethisstatement上启动- -重置--skip-grant-tables密码后,可以将其关闭。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。