重置Mysql密码

  • Linux系统
  1. 停止MySQL进程
    #service mysqld restart
    # /etc/init.d/mysql stop
    或
    # killall -TERM mysqld(不推荐)
  2. 以安全模式启动MySQL
    # mysqld_safe –skip-grant-tables &
    或,
    # mysqld_safe --skip-grant-tables >/dev/null 2>&1 &
  3. 登陆MYSQL
    # mysql -u root
    或,
    # /usr/local/mysql/bin/mysql -u root mysql
  4. 更改ROOT密码
    use mysql;
    select host, user, password from user;
    update user set password=password(“newpassword”) where user=”root”
    flush privileges;
  5. 退出控制台,重启MYSQL服务
    service mysqld restart
    或,
    /etc/init.d/mysql restart

     

 

posted @ 2015-04-17 10:05  桔子大  阅读(358)  评论(0编辑  收藏  举报
/*火箭返回顶层*/