MySQL forget password - xiuyanduan/xiuyanduan.github.io GitHub Wiki
title: MySQL forget password of root
date: 2015-12-12
tags:
- MySQL
- root
---
stop mysql and modify my.cnf
service mysql stop
add below to my.cnf
[mysqld]
skip-grant-tables
reset password of user root
mysql
USE mysql;
UPDATE user SET Password=password('your-new-password') WHERE User='root';
flush privileges;
quit;
modify my.cnf again
remove below from [mysqld]
skip-grant-tables
restart mysql
service mysql restart