MySQL忘记root密码的解决办法
# 1.停掉MySQL进程
[root@standby ~]# /etc/init.d/mysqld stop
Shutting down MySQL... SUCCESS!
[root@standby ~]# # 2.mysqld_safe配置跳过授权表启动MySQL
[root@standby ~]# mysqld_safe --skip-grant-tables --user=mysql &
[1] 1670
[root@standby ~]# 170311 15:00:16 mysqld_safe Logging to '/application/mysql-5.1.72/data/standby.err'.
170311 15:00:16 mysqld_safe Starting mysqld daemon with databases from /application/mysql-5.1.72/data [root@standby ~]# # 3.进入MySQL
[root@standby ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.72 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> # 4.更改root密码
mysql> use mysql;
Database changed
mysql>
mysql> update user set password=password('123456') where user='root' and host='localhost';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0 mysql>
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec) mysql> select user,host,password from mysql.user;
+------+-----------+-------------------------------------------+
| user | host | password |
+------+-----------+-------------------------------------------+
| root | localhost | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| wiki | localhost | *A5DB2D927D6DF94DA5E1CE4B293AEAAB4D8304EA |
| root | 127.0.0.1 | |
+------+-----------+-------------------------------------------+
3 rows in set (0.00 sec) mysql> delete from user where user='root' and host='127.0.0.1';
Query OK, 1 row affected (0.00 sec) mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec) mysql> select user,host,password from mysql.user;
+------+-----------+-------------------------------------------+
| user | host | password |
+------+-----------+-------------------------------------------+
| root | localhost | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| wiki | localhost | *A5DB2D927D6DF94DA5E1CE4B293AEAAB4D8304EA |
+------+-----------+-------------------------------------------+
2 rows in set (0.00 sec) mysql> # 5.停止mysqld_safe方式开启的MySQL进程
[root@standby ~]# mysqladmin -uroot -p123456 shutdown
170311 15:11:08 mysqld_safe mysqld from pid file /application/mysql-5.1.72/data/standby.pid ended
[1]+ Done mysqld_safe --skip-grant-tables --user=mysql
[root@standby ~]#
[root@standby ~]#
[root@standby ~]# lsof -i:3306
[root@standby ~]# ps -ef |grep mysql
root 1967 1330 0 15:11 pts/1 00:00:00 grep --color=auto mysql # 6.正常开启MySQL
[root@standby ~]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS!
[root@standby ~]#
MySQL忘记root密码的解决办法的更多相关文章
- MySQL 5.7 Command Line Client输入密码后闪退和windows下mysql忘记root密码的解决办法
MySQL 5.7 Command Line Client输入密码后闪退的问题: 问题分析: 1.查看mysql command line client默认执行的一些参数.方法:开始->所有程序 ...
- windows下mysql忘记root密码的解决办法
今天早上 一朋友说自己的mysql 忘记root密码了 让我帮忙给看看,因为没有接触过mysql 所以从网上找了一下信息经我亲身实践 已经成功!mysql版本是5.1以下是从网上找的信息: 1. 首 ...
- mysql 忘记root密码的解决办法
1.修改MySQL的登录设置: # vim /etc/my.cnf 在[mysqld]的段中加上一句:skip-grant-tables 例如: [mysqld] datadir=/var/lib/m ...
- windows环境中mysql忘记root密码的解决办法
原文地址:http://www.cnblogs.com/linuxnotes/archive/2013/03/09/2951101.html windows下重置Mysql Root密码的方法mysq ...
- mysql忘记root密码的解决方法
Windows下mysql忘记root密码的解决方法 1. 首先检查mysql服务是否启动,若已启动则先将其停止服务,可在开始菜单的运行,使用命令:net stop mysql 或者在windows任 ...
- Mysql忘记用户密码的解决办法
1.1 忘记用户密码的解决办法 普通用户,直接用root超级管理员登录进去修改密码就可以了,但是如果root密码丢失了,怎么办呢? 1.1.1 msyqld_saft方式找回密码 停止mysql:se ...
- 【转】mysql忘记root密码的解决方法
本文收集于本人的笔记本,由于找不到原文出处.在此省略,如哪位知道可以联系我加上. 方法一:在windows下:1.打开命令行(DOS)窗口,停止mysql服务: net stop mysql 2.在D ...
- linux下mysql的忘记root密码的解决办法
因为放寒假家里没有宽带,便很少上网,前几天用手机进入自己的个人博客时竟然返回数据库不能连接的错误,吓我一跳,网站肯定被人黑了,但转头一想我的博客就几篇破文章,谁这么无聊要黑,我并没有立刻去网上找解决的 ...
- Linux忘记mysql的root密码的解决办法
1.首先确认服务器出于安全的状态,也就是没有人能够任意地连接MySQL数据库. 因为在重新设置MySQL的root密码的期间,MySQL数据库完全出于没有密码保护的 状态下,其他的用户也可以任意地登录 ...
随机推荐
- Pycharm For Linux
之前说过JetBrains系列的破解方式:https://www.cnblogs.com/dunitian/p/8478252.html 现在说下怎么固定到任务栏,速度版 详细讲解可以看之前说安装微信 ...
- nodejs的某些api~(五) HTTP模块
HTTP的模块是nodejs最重要的模块(应该是),最近在看HTTP权威指南,重新过了一遍http协议和web客户端.再来看这个http. HTTP构建于TCP之上,属于应用层协议,继承自tcp服务器 ...
- 时间复杂度和大O表示法
大O表示法:称一个函数g(n)是O(f(n)),当且仅当存在常数c>0和n0>=1,对一切n>n0均有|g(n)|<=c|f(n)|成立,也称函数g(n)以f(n)为界或者称g ...
- 【LOJ#6277】数列分块1
题目大意:维护一个长度为 N 的序列,支持区间修改.单点查询. 代码如下 #include <bits/stdc++.h> using namespace std; const int m ...
- Appium的图像界面浅说
appium的图形用户界面(GUI) (1)Application中各个项的含义作用: Application Path:填写你需要测试的Android APK的包地址(两种方式:1直接点击Choos ...
- 解决plink报错:.bim file has a split chromosome. Use --make-bed by itself to remedy this.
由于plink1.9和1.07这两个版本互掐,经常出现各种不兼容问题,“.bim file has a split chromosome. Use --make-bed by itself to r ...
- Oracle 在JDBC中使用 存储过程,包
前提: 在Oracle中已经定义 存储过程 和 存储函数 和 包 导入了Oracle的JDBC jar 包 package demo; import java.sql.Connect ...
- java键盘中输入q退出
用 java.util.Scanner 如下 public static void main(String[] args) { while(true){ Scanner scan = new Scan ...
- jquery 获取$("#id").text()里面的值 需要进行去空格去换行符操作
Jquery:$("#accuracy").val($("#accuracy").val().replace(/\ +/g,""));//去 ...
- Mac上在终端上解压与压缩
1.安装rar 1.brew install unrar 2.unrar -version 3.进入需要解压的文件目录下,unrar x 文件夹名.rar 1.tar -xvf [file.tar.g ...