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. Android 高级UI设计笔记20:RecyclerView 的详解之RecyclerView添加Item点击事件

    1. 引言: RecyclerView侧重的是布局的灵活性,虽说可以替代ListView但是连基本的点击事件都没有,这篇文章就来详细讲解如何为RecyclerView的item添加点击事件,顺便复习一 ...

  2. js中的命名规范

    在实际开发中规范的命名,不仅方便自己查看,理解变量的实际意义,而且在团队开发中也能提高开发效率. 下面将介绍javascript中的变量的命名规范: 1)首先,变量名要有实际意义,不建议使用单个的字母 ...

  3. Python一些难以察觉的错误

    Python一些难以察觉的错误 今天把微博的收藏夹打开,发现以前很多收藏的好文章还没有细细研究,今天开始要慢慢研究总结总结.今天看的这篇文章地址: http://blog.amir.rachum.co ...

  4. CentOS 7 使用外部邮箱 发送邮件和附件—mail,mailx

    1.查看软件包是否安装 [root@localhost ~]# rpm -qa|grep mail mailx-12.5-12.el7_0.x86_64 javamail-1.4.6-8.el7.no ...

  5. GSS4 2713. Can you answer these queries IV 线段树

    GSS7 Can you answer these queries IV 题目:给出一个数列,原数列和值不超过1e18,有两种操作: 0 x y:修改区间[x,y]所有数开方后向下调整至最近的整数 1 ...

  6. Create a Bootable MicroSD Card

    http://gumstix.org/create-a-bootable-microsd-card.html Create a Bootable MicroSD Card Beginners Note ...

  7. ant 命令学习详解

    ant -verbose  //输出  ant编译时的详情

  8. Directadmin清空所有Tickets命令

    利用一条命令就快速实现了清空所有Tickets的方法,希望此例子对大家有帮助.     即可清空所有工单,包括系统提示 :> /usr/local/directadmin/data/admin/ ...

  9. SQL Server 数据类型简介

    在 SELECT 的查询过程和查询结果中,每个列.变量.表达式和参数都具有一个相关的数据类型.数据类型用于指定某个对象可保存的数据的类型. SQL Server系统的数据类型主要有:数值类型.日期和时 ...

  10. iOS开发中的那些小技巧

    前言:今天在写代码的过程中遇到一个需要修改系统navigationBar的背景色,我起初用的是barTintColor去修改但是防不住系统点击按钮的时候会有一个渲染高亮的效果,调了好久没有达到自己想要 ...