惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
Microsoft Security Blog
Microsoft Security Blog
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
GbyAI
GbyAI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V
V2EX
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
博客园_首页
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
P
Proofpoint News Feed
博客园 - 司徒正美
有赞技术团队
有赞技术团队
Engineering at Meta
Engineering at Meta
Last Week in AI
Last Week in AI
MongoDB | Blog
MongoDB | Blog

博客园 - GeneralXU

股市量化智能分析2035 Mule 官方例子研究 开源企业服务总线ESB汇总与对比 Apache CXF 介绍 JAX-WS eclipse.ini/myeclipse.ini文件中参数配置 Web2.0是什么:下一代软件的业务模式与设计模式 FaceBook网站架构软件揭秘 概念介绍:OLAP和ROLAP,MOLAP,HOLAP Oracle WebCenter 11g 快速开发指南--翻译(三) J2EE框架(TomcatStrutsHibernateSpringAjax(dojo))开发步骤 Oracle WebCenter 11g 快速开发指南--翻译(二) 《人月神话》--摘录 Oracle WebCenter 11g 快速开发指南--翻译(一) ORACLE11G 字符集更改(这里更改为AL32UTF8) oracle 11g登录密码问题 C# Media Player控件(转) java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter 异常解决办法 hibernate -----Could not instantiate cache implementation异常处理(转) - GeneralXU
忘记mysql root密码的解决方法
GeneralXU · 2014-09-15 · via 博客园 - GeneralXU

一. MySQL密码的恢复方法一

有可能你的系统没有 safe_mysqld 程序(比如我现在用的 ubuntu操作系统, apt-get安装的mysql) ,

下面方法可以恢复 1. 停止mysqld; /etc/init.d/mysql stop (您可能有其它的方法,总之停止mysqld的运行就可以了)

2. 用以下命令启动MySQL,以不检查权限的方式启动;

mysqld --skip-grant-tables & 或 mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

3. 然后用空密码方式使用root用户登录 MySQL; mysql -u root mysql

4. 修改root用户的密码;

mysql> update mysql.user set password=PASSWORD('newpassword') where User='root' and host='root' or host='locahost';

mysql> flush privileges;

mysql> quit 重新启动

MySQL /etc/init.d/mysql restart

#mysql -uroot -p

就可以使用新密码 newpassword 登录了。

二. MySQL密码的恢复方法之二 如果忘记了MySQL的root密码,可以用以下方法重新设置:

1. KILL掉系统里的MySQL进程; killall -TERM mysqld

2. 用以下命令启动MySQL,以不检查权限的方式启动; safe_mysqld --skip-grant-tables &

3. 然后用空密码方式使用root用户登录 MySQL; mysql -u root

4. 修改root用户的密码;

mysql> update mysql.user set password=PASSWORD('新密码') where User='root';

mysql> flush privileges;

mysql> quit 重新启动MySQL,

#mysql -uroot -p

就可以使用新密码登录了。