You can recover MySQL database server password with following five easy steps.

Step # 1: Stop the MySQL server process.

Step # 2: Start the MySQL (mysqld) server/daemon process with the --skip-grant-tables option so that it will not prompt for password.

Step # 3: Connect to mysql server as the root user.

Step # 4: Setup new mysql root account password i.e. reset mysql password.

Step # 5:  Exit and restart the MySQL server.

Here are commands you need to type for each step (login as the root user):

Step # 1 : Stop mysql service

# /etc/init.d/mysql stop
Output:

Stopping MySQL database server: mysqld.
Step # 2: Start to MySQL server w/o password:

# mysqld_safe --skip-grant-tables &
Output:

[1] 5988
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[6025]: started
Step # 3: Connect to mysql server using mysql client:

# mysql -u root
Output:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Step # 4: Setup new MySQL root user password

mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit

Step # 5: Stop MySQL Server:

# /etc/init.d/mysql stop
Output:

Stopping MySQL database server: mysqld
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[6186]: ended
[1]+  Done                    mysqld_safe --skip-grant-tables
Step # 6: Start MySQL server and test it

# /etc/init.d/mysql start
# mysql -u root -p

.

kali 重置 mysql 密码的更多相关文章

  1. XAMPP下重置mysql密码

    安装XAMPP后,mysql默认是没有密码的,安全起见一般我们都会修改密码. 密码太多,经常会忘记密码,那么,我们可以通过通过以下步骤可以重置mysql密码. 步骤如下: 1. 停止mysql 2.  ...

  2. Windows下重置MySQL密码(最开始是因为Access denied for user 'root'@'localhost'这个原因,无法登陆 'root'@'localhost')

    本人使用的MySQL5.5,其他版本未测试过. 方法一: 更改密码: mysql -u root -p Enter password:*** mysql>use mysql; 选择数据库 Dat ...

  3. 重置mysql密码

    如何修改mysql root密码 忘记MySQL ROOT密码是在MySQ使用中很常见的问题,可是有很多朋友并不会重置ROOT密码,那叫苦啊,特写此文章与大家交流: 1.编辑MySQL的配置文件:my ...

  4. kali重置root密码

    像这样,kali系统的root密码忘记了,只需一分钟时间,快速重置root密码 第一步: 电脑开机后kali系统会进入引导界面,这是我们只需 “e” 进入启动前编辑命令(若系统没有出现这个页面,大家在 ...

  5. XAMPP重置MySQL密码

    找到XAMPP的安装位置,这里以我的为例:C:\xampp 那么MySQL的路径:C:\xampp\mysql phpMyAdmin的路径:C:\xampp\phpMyAdmin 修改MySQL密码 ...

  6. mysql关闭skip-grant-tables快速重置mysql密码

    如果你忘记了mysql密码几乎是没有什么好办法可以直接修改密码了,但我们可以在my.ini把加上skip-grant-tables,然后重启mysql就不需要密码了,这时我们再修改root密码,最后再 ...

  7. Linux重置mysql密码(转载)

    From:http://hi.baidu.com/mcspring/item/6358ee27afe7e1c8a5275ab7 首先,必须拥有MySQL操作的所有权限: 其次,停止MySQL服务: / ...

  8. WampServer下修改和重置MySQL密码(转)

    转自:www.2cto.com/database/201504/387589.html WampServer安装后密码是空的, 修改一般有两种方式: 一是通过phpMyAdmin直接修改: 二是使用W ...

  9. linux centos重置mysql密码教程

    第一步 查看确定安装了mysql # rpm -qa|grep -i mysql 执行效果如下 第二步 重启mysql: # /etc/init.d/mysqld 截图如下 因为我已经开了,所以用re ...

随机推荐

  1. Android 代码监控apk安装,卸载,替换

    public class GetBroadcast extends BroadcastReceiver { private static GetBroadcast mReceiver = new Ge ...

  2. JavaScript —— 如何判断一个非数字输入

    在页面里,如何用JS去判断一个用户输入是不是一个数字. 你是不是首先想到了正则表达式? JS里有个现成的函数,isNaN(x) isNaN(x) 函数可用于判断其参数是否是 NaN(Not a Num ...

  3. 矩形嵌套 南阳理工ACM

    描述 有n个矩形,每个矩形可以用a,b来描述,表示长和宽.矩形X(a,b)可以嵌套在矩形Y(c,d)中当且仅当a<c,b<d或者b<c,a<d(相当于旋转X90度).例如(1, ...

  4. 《c程序设计语言》读书笔记--统计字符数

    #include <stdio.h> #define MAXLINE 1000 int getline(char line[],int maxline); void copy(char t ...

  5. How to: Synchronize Files by Using Managed Code

    The examples in this topic focus on the following Sync Framework types: FileSyncProvider FileSyncOpt ...

  6. MSAA, UIA brief explanation

    MSAA, UIA brief explanation 2014-07-24 Reference [1] MSAA, UIA brief explanation [2] Testing Tools [ ...

  7. Xcode调试工具Instruments指南

    主要途径是参考苹果官方文档,所以介绍以翻译官方文档为主.由于内容比较多,会分阶段来介绍. 以下来自苹果官方文档中对Instruments描述 介绍 Instruments是一个强大而灵活的性能分析和测 ...

  8. linux安全体系

    一.   硬件.软件选型 确认需求,分析可能面临的安全问题 记录各硬件寿命.保证散热.确保性能冗余 使用商业正版.开源的软件,不从互联网安装系统,从源头保证系统安全 购买专业售后支持 服务器配置双电源 ...

  9. 涵盖网站基本使用的正则表达式的验证方法.cs

    using System; using System.Text.RegularExpressions; using System.Text; using System.IO; using System ...

  10. Linux 查找文件方法

    1) find -name httpd.conf 2) find /etc -name "*repo" 详情查找命令-> http://www.yesky.com/210/1 ...