MySql5.5忘记root密码怎么办
作者:mrr 发布时间:2024-01-23 01:02:45
使用mysql5.5,突然root密码忘记,怎么也登录不了,很急人,该怎么解决呢?下面通过本文给大家介绍mysql5.5忘记root密码的解决办法,需要的朋友参考下吧
方法一:
操作系统:windows操作系统,xp或win7.
C:\Users\Administrator>cd C:\Program Files\MySQL\MySQL Server 5.5\bin
C:\Program Files\MySQL\MySQL Server 5.5\bin>net stop mysql
MySQL 服务正在停止.
MySQL 服务已成功停止。
C:\Program Files\MySQL\MySQL Server 5.5\bin>mysqld --skip-grant-tables
你会看到窗口光标在下一行的第一个位置闪烁,这说明已经启动了,不需要管。
新建一个命令行窗口同样进入到e:\mysql5.5\bin目录,启动mysql
C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.36 MySQL Community Server (GPL)
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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> use mysql;
Database changed
mysql> update user set password=PASSWORD('oracle') where user='root';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2 Changed: 2 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> quit
Bye
看看那任务管理器中是否有mysqld.exe进程,如有,kill .
C:\Program Files\MySQL\MySQL Server 5.5\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql -uroot -poracle
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.36 MySQL Community Server (GPL)
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>
方法二:
操作系统:windows操作系统,xp或win7.
1.dos命令行窗口 进入e:\mysql5.5\bin ,停止mysql 服务
e:\mysql5.5\bin>net stop mysql
注意:看看那任务管理器中是否有mysqld.exe进程,如有,kill them all.
2. 以不检查权限的方式启动mysql
e:\mysql5.5\bin>mysqld.exe --skip-grant-tables
你会看到窗口光标在下一行的第一个位置闪烁,这说明已经启动了,不需要管。
3. 新建一个命令行窗口同样进入到e:\mysql5.5\bin目录,启动mysql
e:\mysql5.5\bin>mysql
4. 修改root密码
mysql>use mysql
mysql>update user set password=PASSWORD('new_password') where user='root';
mysql>flush privileges;
mysql>quit
5. 看看那任务管理器中是否有mysqld.exe进程,如有,kill them all.
6. 重启mysql,就可以用你设置新密码登陆
e:\mysql5.5\bin>net start mysql
e:\mysql5.5\bin>mysql -u root -pnew_password
that's all .


猜你喜欢
- 最近使用到一个文件上传功能,发现恶意上传一个2G文件时,后台处理响应较慢,遂想到能否使用js来进行客户端的验证。但查阅网上多处资料,均使用
- 一.绘制直线在OpenCV中,绘制直线需要获取直线的起点和终点坐标,调用cv2.line()函数实现该功能。该函数原型如下所示:img =
- 事情是这样的,笔者在使用docx库的时候遇到了文字的缩进问题,具体需求是:正文内容每段首行顶两格,也就是向右缩进两个字符,像这样:需求看似很
- 导入mybatis依赖<!--mybatis--><dependency> <groupId>
- 一、读写excel数据利用pandas可以很方便的读写excel数据1.1 读:data_in = pd.read_excel('M
- 安装环境:centos 5.4mysql版本:mysql 5.1.xx 采用rpm直接安装所需软件: xtrabackup 1.2.22 采
- 主要我是要解决一下几个问题: 1. apply和call的区别在哪里 2. apply的其他巧妙
- SQLSRV驱动程序允许您创建一个结果集,其中包含可以根据游标类型以任何顺序访问的行。本主题将讨论客户端(缓冲)和服务器端(非缓冲)游标及其
- Jquery中的一些东西学习一下子,补充完善一下,毕竟有些时候没有使用到这个方式很有用,在使用bootstrap table的时候,选择当前
- 记录了mysql 5.7.19 winx64解压缩版安装教程,具体内容如下系统环境:Win7 x64软件准备:MySQL 5.7.19 wi
- $str = '中华人民共和国123456789abcdefg'; echo preg_match("/^[u4e
- 前言最近在研究怎么对图片资源进行无损压缩,网上也找了一些资料。总而言之,收获不少,所以想对最近的学习做个总结。无损压缩其实是相对而言的,目的
- 目录前言一、算法思想算法分析思想图解二、代码展示1.创建树节点结构2.实现倾倒动作主递归函数数据初始化总结前言有一个充满水的8品脱的水壶和两
- 1、python代码实现图片分割成九宫格需要包含的库,没有下载安装的,需要自己安装哦。实现原理很简单,就是用PIL库不断画小区域,切下来存储
- 本文实例讲述了GO语言延迟函数defer用法。分享给大家供大家参考。具体分析如下:defer 在声明时不会立即执行,而是在函数 return
- 在查询中执行下列语句 EXEC sp_attach_single_file_db @dbname = 'tggov_Data'
- 如下所示:# -*- coding: utf-8 -*-import threadingimport threadimport timecl
- 1.BeautifulSoup简介BeautifulSoup4和 lxml 一样,Beautiful Soup 也是一个HTML/XML的解
- 本文实例讲述了Python基于递归算法实现的汉诺塔与Fibonacci数列。分享给大家供大家参考,具体如下:这里我们通过2个例子,学习pyt
- Python是一门简单而文字简约的语言。阅读好的Python程序感觉就像阅读英语,尽管是非常严格的英语。Python的这种伪代码特性是其最大