MySQL root密码找回
以MySQL多实例为例,演示找回MySQL root的密码
1、关闭mysql服务
[root@mysql ~]# mysqladmin -uroot -poldboy123 -S /data/3306/mysql.sock shutdown ==>通过mysqladmin shutdown优雅关闭mysql服务。
[root@mysql ~]# lsof -i:3306
2、使用--skip-grant-tables参数后台启动mysql,忽略授权验证直接登录
[root@mysql ~]# mysqld_safe --defaults-file=/data/3306/my.cnf --skip-grant-tables & ==>--skip-grant-tables这个参数一定要放在默认文件的后面,&表示后台启动。
[1] 63540
[root@mysql ~]# 160216 22:27:26 mysqld_safe Logging to '/data/3306/mysql_oldboy3306.err'.
160216 22:27:26 mysqld_safe Starting mysqld daemon with databases from /data/3306/data
^C
[root@mysql ~]# lsof -i:3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 64277 mysql 12u IPv4 127392 0t0 TCP *:mysql (LISTEN)
3、登录mysql,使用update语句修改MySQL root密码
[root@mysql ~]# mysql -S /data/3306/mysql.sock ==>做了忽略授权认证,不用密码直接登录;
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.32-log Source distribution Copyright (c) 2000, 2013, 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> update mysql.user set password=PASSWORD("oldboy123") where user='root' and host='localhost'; ==>使用update语句修改MySQL root密码。
Query OK, 0 rows affected (0.26 sec)
Rows matched: 1 Changed: 0 Warnings: 0 mysql> flush privileges; ==>一定要刷新授权表。
Query OK, 0 rows affected (0.05 sec) mysql> \q
Bye
4、使用修改后的root密码登录mysql
[root@mysql ~]# mysql -uroot -poldboy123 -S /data/3306/mysql.sock ==>使用root密码登录。
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.5.32-log Source distribution Copyright (c) 2000, 2013, 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>
至此,找回并修改root密码成功。
MySQL root密码找回的更多相关文章
- MAC 重置MySQL root 密码
重置MySQL root 密码:当忘记密码,或者想要强行重置 MySQL 密码的时候,可以像下面这样: 1.停止 MySQL 服务 sudo /usr/local/mysql/support-file ...
- wamp5 忘记mysql root密码 重置方法
wamp5比较恶心,忘记mysql root密码了,重新安装都没用,网上找了个文章可以修改root的密码. http://www.kuqin.com/database/20080306/4249.ht ...
- 几种破解MySQL root密码的几种方法:
几种破解MySQL root密码的几种方法: 方法一 使用phpmyadmin,这是最简单的了,修改mysql库的user表,不过别忘了使用PASSWord函数. 方法二 使用mysqladmin,这 ...
- 使用SKIP-GRANT-TABLES 解决 MYSQL ROOT密码丢失(转)
B.5.3.2 How to Reset the Root Password If you have never assigned a root password for MySQL, the ser ...
- 不重启修改mysql root密码
不重启修改mysql root密码 --------------------2014/09/28 一.一般忘记密码的解决办法,需要重启Mysql1.skip-grant-tables我们常用的方法是使 ...
- MySQL root密码忘记解决
--MySQL root密码忘记的解决办法 -----------------------------------2014/03/14 1.首先确认服务器出于安全的状态,也就是没有人能够任意地连接My ...
- MySQL root密码忘记,原来还有更优雅的解法!
一直以来,对于MySQL root密码的忘记,以为只有一种解法-skip-grant-tables. 问了下群里的大咖,第一反应也是skip-grant-tables.通过搜索引擎简单搜索了下,无论是 ...
- MySQL root密码忘记后更优雅的解决方法
MySQL root密码忘记后更优雅的解决方法 https://www.jb51.net/article/143453.htm /usr/bin/mysqld_safe --defaults-file ...
- Linux系统初学-第一课 虚拟机安装CentOS6.5以及Root密码找回
Linux系统初学第一课 虚拟机安装CentOS6.5以及Root密码找回 虚拟机安装CentOS6.5 一.安装虚拟机 1-1.安装虚拟机VMware Station,新建虚拟机,选择典型配置. 1 ...
随机推荐
- css中 input的button默认原始的样子
以往我们写css时,让一行文字垂直居中. 会设置line-height等于height比如: 当我把这个原理 放在button上时 会是这个样子的. 以下都是火狐浏览器环境 有没有发现一个现象,他们 ...
- javascript事件执行流程分析
我一直想搞清楚事件在DOM中的传播方式,今天经高人指点终于明白一二.首先扒了一张图: 事件捕获过程:当我们点击TEXT时,首先是window->document->body->div ...
- XE7 & IOS开发之开发账号(3):证书、AppID、设备、授权profile的申请使用,附Debug真机调试、Ad hoc下iPA文件生成演示(XCode5或以上版本推荐,有图有真相)
网上能找到的关于Delphi XE系列的移动开发的相关文章甚少,本文尽量以详细的图文内容.傻瓜式的表达来告诉你想要的答案. 原创作品,请尊重作者劳动成果,转载请注明出处!!! 注意,以下讨论都是以&q ...
- OpenCV的数据类型---Cv
CvScalar就是一个包含四个元素的结构体变量. CvScalar定义可存放1—4个数值的数值,其结构如下. typedef struct CvScalar{ double val[4];}C ...
- Tableau 地图无法识别怎么办
Tableau地图是一个很优秀的工具,可以选择城市或者省份作为单位来显示地图. 前几天做了一个省份的感觉很好,今天用城市做单位居然有些城市识别不了,其中包括贵阳和宿迁. 换了拼音之后贵阳能够识别了 ...
- reference local jar & customize manifest
dependencies { compile files('libs/ghost4j-0.5.1.jar') compile files('libs/jai_imageio.jar') compile ...
- 如何安装NodeJS到阿里云Centos (64位版本V5-7)
如何安装NodeJS到阿里云Centos (64位版本V5-7) (Centos与Red Hat® Enterprise Linux® / RHEL, Fedora属于一类) 1) 安装v0.10版 ...
- 详解rsync算法--如何减少同步文件时的网络传输量
先看下图中的场景,客户端A和B,以及服务器server都保存了同一个文件,最初,A.B和server上的文件内容都是相同的(记为File.1).某一时刻,B修改了文件内容,上传到SERVER上(记为F ...
- html狂记
由于承接一部分站点优化工作,竟无节操地好几天没有喂博客,好了,今天完成交接工作,马上奉上DIV+CSS传统开发的干货一枚,内容绝非原创,仅是收集.学习.消化.总结.吐出... 基本结构标签: < ...
- 500lines项目简介
"500行或更少" "What I cannot create, I do not understand." -- Richard Feynman <50 ...