zoukankan      html  css  js  c++  java
  • (二)mysql忘记root密码

    (1)mysql 5.7.6以前版本

    • 修改配置文件vim /etc/my.cnf
    [mysqld]
    skip-grant-tables
    
    • 重启mysql
    systemctl restart mysqld
    
    • 修改密码和刷新授权表
    mysql>update mysql.user set password=password("redhat") where user="root" and host="localhost";
    mysql>flush privileges;
    
    • 再次修改配置文件
    #skip-grant-tables
    
    • 重启mysql
    systemctl restart mysqld 
    

    (2)mysql 5.7.6以后的版本

    • 修改配置文件vim /etc/my.cnf
    [mysqld]
    skip-grant-tables
    
    • 重启mysql
    systemctl restart mysqld 
    
    • 修改密码和刷新授权表
    mysql> select user,host,authentication_string from mysql.user;
    mysql> update mysql.user set authentication_string=password('redhat') where user="root" and host="localhost";
    mysql> flush privileges;
    
    • 再次修改配置文件vim /etc/my.cnf
    #skip-grant-tables
    
    • 重启mysql
    systemctl restart mysqld 
    
  • 相关阅读:
    jquery常用语句
    记录一个奇异的问题
    冰块渲染2
    冰块渲染
    GCAlloc 问题一则
    矩阵基础3
    优化 Overdraw 和 GrabPass
    优化平面法线贴图
    环境模拟
    使用 GPU 加速计算
  • 原文地址:https://www.cnblogs.com/lovelinux199075/p/8878131.html
Copyright © 2011-2022 走看看