MySQL修改密码和忘记ROOT密码
1、关闭数据库
脚本:[root@mysql etc]# service mysql stop
2、使用脚本: mysqld_safe --skip-grant-tables 启动数据库
使用/usr/bin/mysqld_safe --skip-grant-tables&启动数据库
3、使用空密码进入数据库(mysql命令后直接回车)
[root@mysql ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.20-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) 2000, 2014, 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、使用UPDATE语句修改ROOT密码
mysql> UPDATE mysql.user SET
-> PASSWORD=PASSWORD('root')
-> where
-> User='root' AND Host='localhost';
5、关闭数据库并重新以正常方式启动数据库
[root@mysql ~]# service mysql restart;
Shutting down MySQL.. SUCCESS!
Starting MySQL.. SUCCESS!
[root@mysql ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@mysql ~]# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.20-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) 2000, 2014, 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修改密码和忘记ROOT密码的更多相关文章
- mysql 免安装与 忘记root密码 密码过期
免安装: 参考 :https://blog.csdn.net/werwqerwerwer/article/details/52919939 注:别忘了配置环境变量 忘记root密码解决办法: 1. ...
- ubuntu 忘记密码,忘记root密码的解决办法
ubuntu的root默认是禁止使用的,在安装的时候也没有要求设置root的密码.要使用,给root设置密码就行了,sudo passwd root .如果只是普通用户密码忘了,用root就可以修改. ...
- mysql 5.7.16 忘记root 密码 如何修改root密码
今天在电脑上安装 mysql5.7.16 (压缩包)时,在初始化data文件夹之后,没有记住密码,DOS框没有显示,没办法,为了学习一下怎么修改密码,在网上找了好多方法去解决,最终还是解决了,下面来 ...
- mysql 5.7.26 忘记root密码
1.关闭mysql [root@mysql ~]# /etc/init.d/mysqld stopShutting down MySQL.. SUCCESS! 2.修改参数文件/etc/my.cnf ...
- ubuntu忘记密码,忘记root密码的解决方法
转载于http://forum.ubuntu.org.cn/viewtopic.php?t=272164 ubuntu的root默认是禁止使用的,在安装的时候也没要求你设置root的密码,和红帽系统系 ...
- MySQL 5.7忘记root密码如何修改?
一直以来,MySQL的应用和学习环境都是MySQL 5.6和之前的版本,也没有去关注新版本MySQL 5.7的变化和新特性.今天帮人处理忘记root密码的时时候,发现以前的方法不奏效了.具体情况如下所 ...
- skip-grant-tables 修改linux的mysql忘记root密码
skip-grant-tables 修改linux的mysql忘记root密码 今天修改mysql中的admin用户权限,在执行update user set host =' %' where use ...
- yum 安装 Mysql error ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 开启远程连接 修改登入密码 忘记root密码 配置防火墙规则 随手mark
yum 安装 MYsql: yum install mysql mysql-server mysql-devel -y 1.1 登入报错: ERROR 1045 (28000): Acc ...
- MYSQL忘记root密码后如何修改
方法1: 用SET PASSWORD命令 首先登录MySQL. 格式:mysql> set password for 用户名@localhost = password('新密码'); 例子:my ...
随机推荐
- js如何获取到本周的第一天和最后一天,本月的第一天和最后一天以及本季度的第一天和最后一天
1.首先来一个自己公司项目的源码: 项目需求描述: 从20150712日开始, , 需求①:根据当前时间返回每一周 .周一~周日的日期(需返回2种格式 格式1:7月13日,格式2:2015-07-13 ...
- [动态库]动态库生成和使用以及Makefile编写
转自:https://www.cnblogs.com/ljtknowns/p/5647793.html 文件目录结构如下 1 dynamiclibapp.c 2 Makefile 3 comm/inc ...
- js 控制输入文字个数(换行不算)
如题,换行符在textarea中是要当成一个字符的.用普通的maxlength属性就不行了,于是想到通过事件来控制输入文字的长度. 注意哦,回车换行不能算成字符.这样的话,普通的substring等方 ...
- setfacl命令
setfacl命令是用来在命令行里设置ACL(访问控制列表).在命令行里,一系列的命令跟随以一系列的文件名. 选项 -b,--remove-all:删除所有扩展的acl规则,基本的acl规则(所有者, ...
- 聊聊Java中的拆箱和装箱操作
在刷谷歌面试题的过程中,发现一道有意思的题目,以前没有特别注意,忽略了一些东西,特此记录. 题目要求输出以下代码的结果: public class MyTest { public static voi ...
- Extjs4.x 共享组件,写法
1.项目架构如下: /Application /ext--框架核心文件 /common--共享 /resources--共享资源 /src--共享js(例如,多个模块共享一个store等) /mode ...
- RavenDb学习(六)查询补充特性
.延迟加载 原来的查询方式如下: IEnumerable<User> users = session .Query<User>() .Where(x => x.Name ...
- Sword libcurl使用
libcurl编译 >> ./configure --prefix=/opt/soft/curl --disable-ldap --disable-ldaps >> make ...
- 3、QT分析之消息事件机制
原文地址:http://blog.163.com/net_worm/blog/static/127702419201001432028526/ 上回我们分析到QPushButton的初始化,知道了Wi ...
- qt之QAbstractSocket
这QAbstractSocket 类提供了整个socket的类型,是QTcpSocket和QUdpSocket的基类 创建一个本体套接字,可以调用QAbstractSocket 和 setSocket ...