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 ...
随机推荐
- FallbackFactory启动的时候抛出异常
在Hystrix做熔断的时候,开始用的是FallBack,后来为了找出为啥exception,然后就用了FallBackFactory. 但是奇怪的是,一起动就抛出异常,真的是百思不得骑姐,错了其解. ...
- am335x SPI spi_d0, spi_d1 out, in 模式设定
AM335x SPI DO DI 的模式 参考: https://www.deyisupport.com/question_answer/dsp_arm/sitara_arm/f/25/t/13826 ...
- 【进阶修炼】——改善C#程序质量(4)
46, 显示释放资源,需要实现IDisposable接口. 最好按照微软建议的Dispose模式实现.实现了IDisposable接口后,在Using代码块中,垃圾会得到自动清理. 47, 即使提供了 ...
- c#设计应用程序单实例运行
利用WindowsFormsApplicationBase的IsSingleInstance来控制应用程序只能单实例运行. [DllImport("user32.dll", Ent ...
- ansible示例,离线安装etcd
一.基础介绍 ========================================================================================== 1. ...
- svn 怎么直接同步指定服务器的某个文件夹
背景:首先在svn代码库了,我直接从服务器上拖了一个文件夹下来,但是没有显示svn相关信息(比如:左下角的勾勾).这个时候因为直接拖动下来的时候没有生成对应的.svn文件,所以导致. 解决办法: 选中 ...
- Android学习之SQLite基础
1.新建MySQLiteHelper类继承自SQLiteOpenHelper public class MySQLiteHelper extends SQLiteOpenHelper { privat ...
- 《Qt数据类型》--QByteArray,QString,int,hex之间的转化
对于QString和QByteArray,他们都有一个toInt的静态函数,QString::toInt()是根据string的字面值转化为int类型,比如string:"123" ...
- [Qt] 利用QtWebKit完成JavaScript访问C++对象
一. 介绍 在浏览器扩展或者WebApp的项目经常用的脚本语言javascript有很多局限性,比如,javascript语言不能够夸窗口访问js对象,不能直接读写磁盘文件(这个也正是发明人设计的安全 ...
- android 分辨率
1.术语和概念 术语 说明 备注 Screen size(屏幕尺寸) 指的是手机实际的物理尺寸,比如常用的2.8英寸,3.2英寸,3.5英寸,3.7英寸 摩托罗拉milestone手机是3.7英寸 A ...