zoukankan      html  css  js  c++  java
  • MySQL数据库应用(4)管理实战(2)-- 找回密码

    八、找回丢失的mysql root用户密码

        1、启动修改丢失的MySQL单实例root密码方法

            1)首先停止mysql

    [root@localhost ~]# /etc/init.d/mysqld stop
    Shutting down MySQL. SUCCESS! 

            2)使用--skip-grant-tables启动mysql,忽略授权登录验证

    [root@localhost ~]# mysqld_safe --skip-grant-tables --user=mysql &
    [1] 1866
    [root@localhost ~]# 190919 01:16:35 mysqld_safe Logging to '/application/mysql-5.5.32/data/localhost.localdomain.err'.
    190919 01:16:35 mysqld_safe Starting mysqld daemon with databases from /application/mysql-5.5.32/data
    
    [root@localhost ~]# mysql     < == 登录时空密码

            3)修改root密码为新密码

    mysql> update mysql.user set password=password('dubin') where user='root' and host='localhost';
    Query OK, 1 row affected (0.13 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
    mysql> quit
    Bye

            4)重启服务器再登录

    [root@localhost ~]# /etc/init.d/mysqld stop
    Shutting down MySQL.190919 01:20:07 mysqld_safe mysqld from pid file /application/mysql-5.5.32/data/localhost.localdomain.pid ended
     SUCCESS! 
    [1]+  Done                    mysqld_safe --skip-grant-tables --user=mysql
    [root@localhost ~]# /etc/init.d/mysqld start
    Starting MySQL.. SUCCESS! 
    [root@localhost ~]# mysql -uroot -pdubin
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 1
    Server version: 5.5.32 Source distribution
    
    
    
    ##这里应该是不能用stop停止的,可能是我用set设置密码的原因
    应该是用mysqladmin停止服务

         2、多实例MySQL启动修改丢失root密码

            1)关闭mysql

    [root@localhost ~]# kill mysqld

            2)启动时加 --skip-grant-tables参数

            

            3)修改密码的方法

                               

             4)重启服务用新密码登录

                                  

       

  • 相关阅读:
    ssm接收界面提交的参数为空
    Servlet[jsp]的Servlet.service()引发了具有根本原因的异常无法在web.xml或使用此应用程序部署的jar文件中解析绝对uri:[http://java.sun.com/jsp/jstl/core]
    Invalid bound statement (not found)
    Data truncation: Incorrect datetime value: '' for column 'create_time' at row 1 问题
    4月29日:毕业设计计划
    4月25日:毕业设计计划
    4月24日:毕业设计计划
    4月23日:毕业设计计划
    2020年寒假学习进度(二)
    2020年寒假学习进度(一)
  • 原文地址:https://www.cnblogs.com/cnxy168/p/11570486.html
Copyright © 2011-2022 走看看