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!
  • 相关阅读:
    【iOS
    【iOS】Swift ESTabBarController的使用
    【iOS
    【iOS】图表实现-Charts(二)
    【iOS】图表实现-Charts(一)
    【iOS】图表实现-AAChartKit
    【iOS】图表实现-总述
    【iOS
    【iOS
    整理下开发中常用的第三方库
  • 原文地址:https://www.cnblogs.com/dinghailong128/p/13404935.html
Copyright © 2011-2022 走看看