zoukankan      html  css  js  c++  java
  • MySQL 超级管理员密码忘记了,怎么处理

    --skip-grant-tables    :跳过授权表
    --skip-networking      :跳过TCP/IP连接
    [root@master1 ~]# pkill mysqld
    [root@master1 ~]# /etc/init.d/mysqld start
    Starting MySQL. SUCCESS! 
    [root@master1 ~]# /etc/init.d/mysqld stop
    Shutting down MySQL.. SUCCESS! 
    [root@master1 ~]# systemctl start mysqld --skip-grant-tables
    systemctl: unrecognized option '--skip-grant-tables'
    [root@master1 ~]# service mysqld start --skip-grant-tables
    Starting MySQL. SUCCESS! 
    [root@master1 ~]# mysql

    (1)关闭数据库

    [root@master1 ~]# systemctl stop mysqld

    (2)使用安全模式启动

    [root@master1 ~]# mysqld_safe --skip-grant-tables --skip-networking &
    或者
    [root@master1 ~]# service mysqld start --skip-grant-tables --skip-networking

    (3)登录数据库并修改密码

    [root@master1 ~]# mysql
    
    mysql> alter user root@'localhost' identified by 'mysql';
    ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
    mysql>
    mysql> flush privileges;    # 手工加载授权表
    mysql> alter user root@'localhost' identified by 'mysql';

    (4)重启数据库到正常模式

    [root@master1 ~]# service mysqld restart
    Shutting down MySQL.. SUCCESS! 
    Starting MySQL. SUCCESS!
  • 相关阅读:
    springboot+fegin实现负载均衡
    springcloud实现微服务服务注册、负载均衡
    spring boot服务状态监控+shell远程连接服务
    微服务基础概念及相关技术组件
    集群分布式基础概念及了解
    http第一章-telnet测试
    spring整合netty

    springMVC+spring+JPA配置文件
    CAN信号值解析
  • 原文地址:https://www.cnblogs.com/dinghailong128/p/13404935.html
Copyright © 2011-2022 走看看