---
title: "linux下mysql 忘记root密码如何破解"
author: "blessdyb"
date: "2010-10-08T23:15:54Z"
tags: ["Linux", "MySQL"]
categories: ["数据库"]
slug: "linux-mysql-root"
draft: false
lastmod: "2010-10-08T23:15:54Z"
id: 779053
url: "https://blessdyb.iteye.com/blog/779053"
---

\# /etc/init.d/mysql stop  
\# mysqld\_safe --user=mysql --skip-grant-tables --skip-networking &  
\# mysql -u root mysql  
mysql&gt; UPDATE user SET Password=PASSWORD('newpassword') where USER='root';  
mysql&gt; FLUSH PRIVILEGES;  
mysql&gt; quit  
\# /etc/init.d/mysql restart  
\# mysql -uroot -p  
Enter password: &lt;输入新设的密码newpassword&gt;  
mysql&gt;