MySQL root密码更改 [英] MySQL root password change

查看:91
本文介绍了MySQL root密码更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试重置我的MySQL根密码.我已经运行了mysqld_safe --skip-grant-tables,更新了根密码,并检查了用户表以确保它在那里.重新启动mysql守护程序后,我尝试使用刚刚设置的新root密码登录,但仍然由于用户"root"错误而拒绝访问.我也尝试过完全删除并重新安装mysql(包括删除my.cnf文件),但还是没有运气.有人对我下一步的工作有什么建议吗?

I have been trying to reset my MySQL root password. I have run the mysqld_safe --skip-grant-tables, updated the root password, and checked the user table to make sure it is there. Once restarting the mysql daemon I tried logging in with the new root password that I just set and still get Access denied for user 'root' errors. I have also tried completely removing and reinstalling mysql (including removing the my.cnf file) and still no luck. Does anyone have any suggestions on what I can do next?

预先感谢

推荐答案

找到了!更改密码时,我忘记对密码进行哈希处理.我使用此查询解决了我的问题:

Found it! I forgot to hash the password when I changed it. I used this query to solve my problem:

update user set password=PASSWORD('NEW PASSWORD') where user='root';

我忘记了PASSWORD('NEW PASSWORD'),只是以纯文本形式输入了新密码

I forgot the PASSWORD('NEW PASSWORD') and just put in the new password in plain text

这篇关于MySQL root密码更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆