1.修改/etc/my.conf,添加参数skip-grant-tables
2.重启mysql
service mysqld stop
service mysqld start
3.用root 直接登录
[root@bogon ~]# mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.11 MySQL Community Server (GPL) Copyright (c) 2000, 2016, 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>
4.修改密码
mysql> alter user 'root'@'localhost' identified by 'newpassword';
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql>
这种方式不好使,换一种方式: mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed
mysql> update user set authentication_string=PASSWORD('newpassword') where User='root';
Query OK, 1 row affected, 1 warning (0.07 sec)
Rows matched: 1 Changed: 1 Warnings: 1 mysql>
5.将/ect/my.conf 修改回来,重启mysql 测试新密码
[root@bogon ~]# service mysqld stop
Stopping mysqld: [ OK ]
[root@bogon ~]# service mysqld start
Starting mysqld: [ OK ]
[root@bogon ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.11 MySQL Community Server (GPL) Copyright (c) 2000, 2016, 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> 修改完成

MySQL 5.7.11 重置root密码的更多相关文章

  1. CentOs中mysql服务器重置root密码方法

    1. 停止mysql: service mysqld stop 2. 编辑/etc/my.cnf,在[mysqld]这行后面加上skip-grant-tables ,并保存 3. 启动mysql: s ...

  2. MySQL重置root密码提示"Unknown column ‘password"的问题?

    晚上打开MAC,发现root帐户突然不能正常登陆MySQL,于是打算重置密码,看了几篇文章,竟然重置不成功,总是得到Unknown column 'password'的错误,看了user的表结构也确实 ...

  3. mysql 重置root密码

    最近又项目用到mysql 由于电脑上mysql是很久以前安装的root密码忘记了, 百度一下重置密码 Windows: 1.以系统管理员登陆: 2.停止MySQL服务: 3.进入CMD,进入MySQL ...

  4. MySQL重置root密码的几种方法(windows+Linux)

    重置root密码的方法: windows系统下:1.停止mysql服务:2.新建文件init-root.txt,写上如下内容: update mysql.user set password = pas ...

  5. MySQL密码忘了怎么办?MySQL重置root密码方法

    本文主要介绍Windows和Linux系统下忘记密码重置root密码的方法,需要的朋友可以参考下. MySQL有时候忘记了root密码是一件伤感的事.这里提供Windows 和 Linux 下的密码重 ...

  6. MySQL忘记root密码--不重启mysqd重置root密码

    先提个问题:如何不重启mysqld,且没有权限修改用户账号和权限的情况下,如何重新设置root密码?不知道没关系,在此之前我也是不知道如何操作的,先看看下面的几种重置root密码的方法. 1.skip ...

  7. MySql登陆密码忘记了怎么办?MySQL重置root密码方法

    本文主要介绍Windows和Linux系统下忘记密码重置root密码的方法,需要的朋友可以参考下. MySQL有时候忘记了root密码是一件伤感的事.这里提供Windows 和 Linux 下的密码重 ...

  8. linux环境下mysql 5.7.1X 如何重置root密码

    1,vi  /etc/my.cnf [mysqld]下加入参数skip-grant-tables   保存退出. 2,重启mysql [root@21yunwei src]# /etc/init.d/ ...

  9. 【转】CentOS6下安装mysql后,重置root密码方法

    本文转自:CentOS6下安装mysql后,重置root密码方法 centos下安装mysql,居然不知道root用户密码,本想重装,不过还是先度娘了一些,发现这篇文章,刚好解决我的燃眉之急,太赞了. ...

随机推荐

  1. WinDBG快速定位异常位置

    在WinDBG中通过搜索内存中保存的CONTEXT结构来定位发生的异常信息,再通过WinDBG命令.cxr显示对应的调用堆栈信息.   .foreach ( place { s-[1]d 0 L?FF ...

  2. 【HTML5 4】《HTML5与CSS3权威指南》 step1 导读

    一.教程重点:以 HTML5和CSS3的新功能和新特性 为导向,辅之以 实战型实例页面 二.内容概况: 第1部分:详细讲解HTML5相关知识,包括 各主流浏览器对HTML5的支持情况. HTML5与H ...

  3. 解决eclipse下pydev的unresolved import的问题

    有些模块,比如PIL,已经装入过,但是在pydev中无法自动提示,甚至有报 unresolved import的问题,虽然不会引起运行时问题,但是无法实现自动提示,还是一件很麻烦的事情.   下面有个 ...

  4. LeetCode 337

    House Robber III The thief has found himself a new place for his thievery again. There is only one e ...

  5. 用pf透明地将流量从一台机器转到另一台机器上的缘起及实现方式对比

    下面是也是我在12580工作时发生的事情,重新记录并发出来.这种特殊需求很考 验PF的功底.在新旧系统并存,做重构的时候有时很需要这种救急的作法.一.缘起miscweb1(172.16.88.228) ...

  6. CF 319C - Kalila and Dimna in the Logging Industry 斜率优化DP

    题目:伐木工人用电锯伐木,一共需要砍n棵树,每棵树的高度为a[i],每次砍伐只能砍1单位高度,之后需要对电锯进行充电,费用为当前砍掉的树中最大id的b[id]值.a[1] = 1 , b[n] = 0 ...

  7. 转载事务在C#方法里的应用

    问题:一个系统的数据库更新或者插入的时候若遭遇到断电等能引起数据库不能正常工作的情况的话,其更新或插入的将是不完整的数据,或者是错误的数据.故需要引入事务处理. 实例:数据更新的事务处理. 解决方案: ...

  8. JNA结构体参数传递,Java数组

    JNA以结构体数组为参数进行调用: ////// C++ // student 结构体定义 typedef struct { int age; char name[20]; }Student; //  ...

  9. PHP和CS的引用传值

    PHP的引用传值 function change_value($num){ $num+=2; } $age = 3; change_value(&$age); echo $age; CS的引用 ...

  10. WPF非UI线程获取修改控件属性值的方法

    public class InvokeHelper { #region delegates private delegate object MethodInvoker(Control control, ...