之前 有写过一篇修改mysql数据库的密码的一篇随笔,
地址是:http://www.cnblogs.com/sxdcgaq8080/p/5667124.html
但是此次采用原本的老方法,出现了问题。
在进行到第5步的时候,出现了如下的问题:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N O)
类似于这种问题:
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: YES)
这类型的错误都是经常在这种情况下出现的。

那么,依旧想修改mysql的密码怎么办?
操作如下:
1.找到配置文件my.ini ,然后将其打开,记事本编辑即可

2.在my.ini文件中搜索【 mysqld 】括号中的关键字

3.定位到这个位置后,在它下面添加原来老方法 中的这么一段:【skip-grant-tables】括号中代码,添加完成,保存关闭。如果提示无法保存,将本文件剪切至桌面或者其他位置,操作完成后放回到原来位置即可。

4.操作完成后,进入控制面板,找到管理工具,找到服务,进入服务,重启mysql
 

5.操作完成后,就可以继续老方法中的方式【以下图均采用老方法图】
cmd-->进入到mysql安装路径下-->这个在bin目录下,键入: mysql -u root -p

6.不输入密码,直接回车,进入交互界面

7.
在mysql的交互页面下,输入update语句,为root账户设置新密码,语句如下:
update mysql.user set Password=password("root") where Host="localhost" and User="root";
注意,这里是将root账户的密码设置为root了。并且,update语句需要;结尾。
回车之后,就显示changed 1 一个更改成功了。

8.可以打开一个心的DOS窗口,进行验证,也可以直接用SQLyog启动,验证是否成功。

9.修改好密码之后,将my.ini文件中的那句话去掉,回复文件原状!!!
10.完成!
|