mysqld --default-file="my.ini或my.cnf路径" --console --skip-grant-tablesupdate user set password=password('newpassword') where user='root'; flush privileges quit
mysqld --default-file="my.ini或my.cnf路径" --console --skip-grant-tablesupdate user set password=password('newpassword') where user='root'; flush privileges quit
我的是window下的mysql密码修改 前天我也是密码忘记了 总结了下步骤 参看给你看下1 在服务里面先把mysql服务停止 2 然后在C:\Program Files\MySQL\MySQL Server 5.1 下找到my.ini 文件 并在[mysqld]下面添加参数 skip-grant-tables 保存 3 启动mysql服务 4登陆mysql此时不需要密码 5 可以查看mysql数据库表中的权限 但是按照网上查询处理的方法 修改密码 报错:skip-grant-tables启动 不能修改密码 update user set Password='' where Host='localhost';将密码置为空 6 关闭mysql服务 修改my.ini文件 将 skip-grant-tables 参数注释掉 保存 7 启动服务(此时也不需要密码已将密码置空) grant all on *.* to 'root'@'localhost' identified by '123456'; 设置成功 退出 重新登陆 成功
http://topic.csdn.net/u/20090515/21/2b3c9a12-d8a5-4bb1-9895-6069cef5aef8.html
flush privileges
quit
flush privileges
quit
前天我也是密码忘记了 总结了下步骤 参看给你看下1 在服务里面先把mysql服务停止
2 然后在C:\Program Files\MySQL\MySQL Server 5.1 下找到my.ini 文件
并在[mysqld]下面添加参数 skip-grant-tables 保存
3 启动mysql服务
4登陆mysql此时不需要密码
5 可以查看mysql数据库表中的权限 但是按照网上查询处理的方法 修改密码 报错:skip-grant-tables启动 不能修改密码
update user set Password='' where Host='localhost';将密码置为空
6 关闭mysql服务 修改my.ini文件 将 skip-grant-tables 参数注释掉 保存
7 启动服务(此时也不需要密码已将密码置空)
grant all on *.* to 'root'@'localhost' identified by '123456';
设置成功 退出 重新登陆 成功