博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
kali 重置 mysql 密码
阅读量:6958 次
发布时间:2019-06-27

本文共 1622 字,大约阅读时间需要 5 分钟。

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] 5988Starting mysqld daemon with databases from /var/lib/mysqlmysqld_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-logType '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: mysqldSTOPPING server from pid file /var/run/mysqld/mysqld.pidmysqld_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

 

转载于:https://www.cnblogs.com/xyh592/articles/4891112.html

你可能感兴趣的文章
ClassFlow推出全新课堂活动轨迹功能
查看>>
高性能计算在电网技术中的应用
查看>>
亿级下ApsaraDB HBase Phoenix秒级内RT在大搜车实践
查看>>
EMC高管:戴尔Nutanix一体机与EMC超融合产品之间不存在竞争
查看>>
十分钟看懂时序数据库II——预处理
查看>>
O2O探秘:实体店背后的科学
查看>>
《构建实时机器学习系统》一3.2 Pandas 的安装
查看>>
创新驱动转型发展 江波龙科技携手IBM构建物联网云数据服务系统
查看>>
揭秘eBay四大系统 从行为数据中寻找价值
查看>>
Google 404页面暗藏漏洞,可泄漏服务器内部信息
查看>>
排除网络故障的十大真理
查看>>
辉瑞健康药物部联手易传媒 打造大数据管理平台
查看>>
CIO们从云中学到的那些经验教训
查看>>
混合云和多云管理不再难:基础架构即代码来帮忙
查看>>
大数据能否解决城市所面临的环境问题
查看>>
数据库安全需要遵循的8项最佳实践
查看>>
关于HTTP推送的一些问题
查看>>
Spring IoC 学习(2)
查看>>
综合布线系统的设计分析
查看>>
论金融机构采用CDP容灾备份的意义
查看>>