学以致用

focus on Python , C++, and some interest in Go and R

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

刚刚接手一个项目,想看看mysql数据库中存储的内容,但root的密码已经丢失,无奈,只能重置root密码。现将重置过程记录。

(1)暂停mysqld服务
  # /etc/init.d/mysqld stop
(2)使用安全模式启动mysqld
 # mysqld_safe --skip-grant-tables &
(3)待mysql启动后以root身份进入
 # mysql -u root
(4)重置密码

  mysql> use mysql;
  mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
  mysql> flush privileges;
  mysql> quit
(5)重启mysql服务
  # /etc/init.d/mysqld restart
至此root密码已完成重置



posted on 2011-08-03 14:11  Jerry.Kwan  阅读(271)  评论(0编辑  收藏  举报