---
title: "mysql 忘记root密码解决方法"
author: "不念书的小子"
date: "2010-08-04T10:46:50Z"
tags: ["MySQL", "mysql 忘记root密码解决方法", "不念书的小子"]
categories: ["数据库"]
slug: "mysql-root"
draft: false
lastmod: "2011-07-13T09:45:27Z"
id: 728608
url: "https://tompig.iteye.com/blog/728608"
---

**2. 用以下命令启动MySQL，以不检查权限的方式启动；**  
**mysqld --skip-grant-tables**

**3. 然后用空密码方式使用root用户登录 MySQL；**  
**mysql -u root**  
**4. 修改root用户的密码；**  
**mysql&gt; update mysql.user set password=PASSWORD('newpassword') where User='root';**  
**mysql&gt; flush privileges;**  
**mysql&gt; quit**