MySQL5.7 忘记root密码,怎么破?

关服

# kill $mysql_pid

免密启动

# /usr/local/mysql57/bin/mysqld_safe --defaults-file=/etc/my.cnf --skip-grant-tables &
[1] 16688
2017-12-08T10:32:24.764472Z mysqld_safe Logging to '/data/database/mysql/host-30-0-0-196.err'.
2017-12-08T10:32:24.901997Z mysqld_safe Starting mysqld daemon with databases from /data/database/mysql

改密码呀

# /usr/local/mysql57/bin/mysql -S /tmp/mysql.sock
mysql> update mysql.user set authentication_string=password('4a68a3c809c38e31') where user='root' ;
Query OK, 1 row affected, 1 warning (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 1 mysql> quit
Bye

重启

# /usr/local/mysql57/bin/mysqladmin -S /tmp/mysql3308.sock shutdown
2017-12-08T10:33:02.360399Z mysqld_safe mysqld from pid file /data/database/mysql/host-30-0-0-196.pid ended
[1]+ Done 阿/usr/local/mysql57/bin/mysqld_safe --defaults-file=/etc/my.cnf --skip-grant-tables # /usr/local/mysql57/bin/mysqld_safe --defaults-file=/etc/my.cnf

还得再改一次

You must reset your password using ALTER USER statement before executing this statement.
mysql> alter user root@localhost identified by '4a68a3c809c38e31';
Query OK, 0 rows affected (0.01 sec)

可以了

MySQL5.7 忘记root密码,怎么破?的更多相关文章

  1. MySql5.5忘记root密码的解决方法

    试了很多方法,下面这种方法是确保可以成功的,呵呵.转载自:http://hi.baidu.com/bjben/item/722bb50b27baf1dcdde5b097. 申明:本文章应该属于转载,但 ...

  2. linux下mysql-5.6忘记root密码,重置root密码详细过程

      在linux平台下使用mysql过程中忘记了root密码,对于运维和DBA来讲都是一件头疼的事情,下面来讲解下怎么进行重置mysql数据库root 密码: 1.首先停止mysql服务进程: 1 s ...

  3. linux下mysql5.7忘记root密码修改

    朋友最近开始学服务器,mysql密码忘了又不会弄,让我帮忙解决一下.重置或修改mysql的root密码这种事平时很少做,还是得google辅助一下,于是弄完了写篇博客记录一下,方便若干月后又有人遇到这 ...

  4. centos7——mysql5.7忘记root密码的处理方式

    参考资料:https://www.cnblogs.com/nangch/p/5521193.html 解决方法: 一.通过编辑/etc/my.cnf文件在[mysqld]下面加上skip-grant- ...

  5. Mysql5.7忘记root密码及mysql5.7修改root密码的方法

    转自:http://www.jb51.net/article/77858.htm 关闭正在运行的 MySQL : ? 1 [root@www.woai.it ~]# service mysql sto ...

  6. 【转】windows下mysql5.1忘记root密码解决方法

    步骤如下:1.停止mysql服务(以管理员身份,在cmd命令行下运行) net stop mysql D:\>net stop mysql MySQL 服务正在停止. MySQL 服务已成功停止 ...

  7. windows下mysql5.1忘记root密码解决方法[win7]

    步骤如下:1.停止mysql服务(以管理员身份,在cmd命令行下运行) net stop mysql2.使用 mysqld –skip-grant-tables 命令启动mysql数据库 D:\> ...

  8. MYSQL5.7 忘记ROOT密码/初始化ROOT密码

    编辑my.cnf允许空密码登录 [root@7Core ~]# vi /etc/my.cnf #在[mysqld]下加入一行 skip-grant-tables=1 重新启动Mysql服务 [root ...

  9. Mysql5.7忘记root密码及修改root密码的方法

    Mysql 安装成功后,输入 mysql --version 显示版本如下 mysql Ver 14.14 Distrib 5.7.13-6, for Linux (x86_64) using 6.0 ...

随机推荐

  1. fasttext学习笔记

    When to use FastText? The main principle behind fastText is that the morphological structure of a wo ...

  2. [LeetCode] 704. Binary Search_Easy tag: Binary Search

    Given a sorted (in ascending order) integer array nums of n elements and a target value, write a fun ...

  3. MSSqlServer 发布/订阅配置(主从同步)

    背景: 1.单个独立数据库的吞吐量是有瓶颈的,那么如何解决这个瓶颈? 2.服务器直接数据如何复制.并具备一致性.可扩展性? 资源: 官方资源:https://technet.microsoft.com ...

  4. JavaScript数组去重方法总结

    一.双重遍历去重 function onlyFigure(arr) { let newarr = []; const length = arr.length for (let i = 0; i < ...

  5. 如何遍历tabcontrol控件的所有的tabpage中的所有控件

    foreach(Control c in tabControl1.TabPages)这个循环的意思是说,遍历tabControl1中所有的TabPages,TabPages是包含在tabControl ...

  6. .NET 黑魔法 - 自定义日志扩展

    我们开发程序时避免不了要有日志系统,我们希望有一个通用的.不夹杂任何方言的调用方式,简单地说就是保留微软日志框架的注入方式和使用方式. 比如我们希望这样调用: 我们不希望有个 IAbcLogger, ...

  7. arcgis api for js简要笔记

    1.主要借助官网的接口文档和samplecode来学习 https://developers.arcgis.com/javascript/latest/api-reference/index.html ...

  8. 002-golang安装配置

    1.安装位置: 2.环境变量. path的值如下: 3.工作目录.

  9. 软工网络15团队作业4——Alpha阶段敏捷冲刺5.0

    1.每天举行站立式会议,提供当天站立式会议照片一张. 2.项目每个成员的昨天进展.存在问题.今天安排. 成员 昨天已完成 今天计划完成 郭炜埕 完善新建话题界面 实现前端各界面的跳转连接 郑晓丽 进行 ...

  10. Vue系列之 => 列表动画

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...