一、编辑mysql配置文件my.ini(在mysql的安装目录下,个人在D:\Program Files\MySQL\MySQL Server 5.0\my.ini),在[mysqld]这个条目下添加一行 skip-grant-tables 保存退出后重启mysql;mysql
二、cmd里面输入mysql -u root -p,登陆mysql;sql
三、进入mysql数据库:数据库
mysql> use mysql;
Database changedide
四、给root用户设置新密码:
mysql> update user set password=password("xxx") where user="root";
Query OK, 1 rows affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0spa
五、注释掉第1步中添加的skip-grant-tables 保存退出并重启orm