• 编辑 my.cnf 

    [mysqld]下插入 skip-grant-tables
[root@VM_0_7_centos mysql]# vim /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html [mysqld]
skip-grant-tables #
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
  • 重启 MySQL 服务
[root@VM_0_7_centos mysql]# service mysqld restart
  • 进入MySQL
[root@VM_0_7_centos mysql]# mysql -uroot
  • 更新密码
  1. flush privileges;
  2. alter user 'root'@'localhost' identified with mysql_native_password by '';
  3. flush privileges;
  4. exit;
  • 编辑 my.cnf  注释掉 skip-grant-tables
  • 重启MySQL服务
[root@VM_0_7_centos mysql]# service mysqld restart
  • 进入MySQL 输入密码
[root@VM_0_7_centos mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.7. MySQL Community Server (GPL) Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
  • 结束

mysql5.7.26-忘记密码(CentOS为例)的更多相关文章

  1. MySQL5.7.26 忘记Root密码小计

    以前直接修改mysql.user就ok了,现在不行了,正好虚拟机MySQL的root密码忘记了,就简单记录下:(本方法不适合互联网线上项目,除非你不在意这段时间的损失) PS:以UbuntuServe ...

  2. Mysql5.7在忘记密码的情况下如何修改密码?

    1.停止服务 2.mysqld --skip-grant-tables 3.回车之后就不要动了,再新打开一个命令提示符窗口,同样进入mysql的安装目录下, 输入:mysql -u root -p 密 ...

  3. mysql5.7忘记密码修改方法

    mysql5.7忘记密码修改方法 mysql是开发中最常用的关系数据库之一.一般在安装数据库到时候会自定义root密码,有时候会忘记该密码,这时候需要对数据库进行密码修改. 一.windows下更改m ...

  4. CentOS 6.5 MySQL5.6.26源码安装

    一.源码安装cmake工具 从mysql5.5起,mysql源码安装开始使用cmake wget http://cmake.org/files/v3.2/cmake-3.2.3.tar.gztar z ...

  5. Centos忘记密码怎么修改

    使用Centos系统忘记密码 在我们日常使用Centos系统时,有些人不免会出现一个共同的问题:忘记登录密码! 我们总不能再重装一遍吧! 接下来我们就分两种情况来看看: Centos系统在云服务器 C ...

  6. Linux-1:安装&忘记密码&CRT连接centos 6.5

    我是在虚拟机VM安装的centos 6.5 一.Linux安装 Ctrl + Alt:鼠标退出LINUX界面 安装我是参考,当然也可以根据网上教程安装:http://oldboy.blog.51cto ...

  7. CentOS 6忘记密码解决办法,root和普通用户均可

    转自nui111的文章:http://blog.csdn.net/nui111/article/details/28007357 说明 操作系统:CentOS 6.0 遇到问题:忘记管理员账号root ...

  8. Linux下Mysql5.7忘记密码

    一.问题 linux下的mysql5.7忘记密码 二.解决 第一步:打开mysql5.7的配置文件my.cnf,并在里面增加一行:skip-grant-tables   保存并退出(:wq) [roo ...

  9. CentOS忘记密码修改方案以及centos卡在开机登录界面,命令失效的解决方法

    CentOS忘记密码修改方案 应用场景 linux管理员忘记root密码,需要进行找回操作. 注意事项:本文基于CentOS7.2环境进行操作的,由于CentOS的版本之间是有差异的,继续之前请先确定 ...

  10. mysql5.7忘记密码

    注意:mysql5.7 user表密码字段由password改为authentication_string 1.service mysql stop 2.mysqld_safe --skip-gran ...

随机推荐

  1. visudo编辑sudoers

    [root@b ~ ]# visudo   #编辑配置文件 相当于vim /etc/sudoers文件 root用户名(谁) ALL任何主机(哪里)=(ALL) 以什么身份(可以切换到所有用户下) a ...

  2. SPEL 表达式解析

    Spring Expression Language 解析器 SPEL解析过程 使用 ExpressionParser 基于 ParserContext 将字符串解析为 Expression, Exp ...

  3. 搭建第一个netty程序

    来自action In netty 自己修改一点点 主要依赖 <dependencies> <dependency> <groupId>io.netty</g ...

  4. 系统分析与设计HW5

    个人作业 领域建模 a. 阅读 Asg_RH 文档,按用例构建领域模型. 按 Task2 要求,请使用工具 UMLet,截图格式务必是 png 并控制尺寸 说明:请不要受 PCMEF 层次结构影响.你 ...

  5. div动画旋转效果

    animation: spin 10s linear infinite;

  6. Linux监控命令之==>top

    一.命令说明 top 命令能够实时监控系统的运行状态,并且可以按照CPU.内存和执行时间进行排序,同时top 命令还可以通过交互式命令进行设定显示,通过top 命令可以查看即时活跃的进行. 二.参数说 ...

  7. LoadRunner11安装及破解

    一.LoadRunner11安装 以管理员身份运行setup.exe 选择第一个LoadRunner完整安装程序 按照界面会弹出以上提示框,直接选择否 检查系统缺少哪些组件,点击“确定”自动安装 点击 ...

  8. spss中如何处理极端值、错误值

    spss中如何处理极端值.错误值 spss中录入数据以后,第一步不是去分析数据,而是要检验数据是不是有录入错误的,是不是有不合常理的数据,今天我们要做一个描述性统计,进而查看哪些数据是不合理的.下面是 ...

  9. DELPHI中函数、过程变量的声明与应用

    Procedure型变量: 在DELPHI中,函数.过程的地址可以赋给一个特殊类型的变量,变量可用如下方式声明: var p : procedure(num:integer); //过程 或: var ...

  10. Scala的集合框架

    1.元组 定义方式:val tp=("nana',1,1.1) 特点:集合中的数据可以是不同类型的 最多只能放22个元素 取值:通过角标取值,这里的角标是从1开始的,元组名称._角标   t ...