Home Database Mysql Tutorial 忘记Mysql的root密码的处理办法

忘记Mysql的root密码的处理办法

Jun 07, 2016 pm 06:08 PM
mysql root stop Method deal with password forget

1,停止MYSQL服务,CMD打开DOS窗口,输入 net stop mysql 2,在CMD命令行窗口,进入MYSQL安装目录 比如E:\Program Files\MySQL\MySQL Server 5.0\bin 示范命令: 输入 e:回车, 输入cd E:\Program Files\MySQL\MySQL Server 5.0\bin 注意双引号也要输入,这样就

1,停止MYSQL服务,CMD打开DOS窗口,输入 net stop mysql


2,在CMD命令行窗口,进入MYSQL安装目录 比如E:\Program Files\MySQL\MySQL Server 5.0\bin

示范命令:

输入 e:回车,
输入cd "E:\Program Files\MySQL\MySQL Server 5.0\bin"
注意双引号也要输入,这样就可以进入Mysql安装目录了.


3,进入mysql安全模式,即当mysql起来后,不用输入密码就能进入数据库。
命令为: mysqld-nt --skip-grant-tables
(Mysql 5.5为:
mysqld --skip-grant-tables
)


4,重新打开一个CMD命令行窗口,输入mysql -uroot -p,使用空密码的方式登录MySQL(不用输入密码,直接按回车)



5,输入以下命令开始修改root用户的密码(注意:命令中mysql.user中间有个“点”)
mysql> update mysql.user set password=PASSWORD('新密码') where User='root';

6,刷新权限表
mysql> flush privileges;



7,退出
mysql> quit

这样MYSQL超级管理员账号 ROOT已经重新设置好了,接下来 在任务管理器里结束掉 mysql-nt.exe 这个进程,重新启动MYSQL即可!(也可以直接重新启动服务器)

MYSQL重新启动后,就可以用新设置的ROOT密码登陆MYSQL了!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP's big data structure processing skills PHP's big data structure processing skills May 08, 2024 am 10:24 AM

PHP's big data structure processing skills

How to optimize MySQL query performance in PHP? How to optimize MySQL query performance in PHP? Jun 03, 2024 pm 08:11 PM

How to optimize MySQL query performance in PHP?

How to easily get the WiFi password of a connected mobile phone (quickly find the WiFi password saved in the mobile phone) How to easily get the WiFi password of a connected mobile phone (quickly find the WiFi password saved in the mobile phone) May 08, 2024 pm 01:10 PM

How to easily get the WiFi password of a connected mobile phone (quickly find the WiFi password saved in the mobile phone)

How to use MySQL backup and restore in PHP? How to use MySQL backup and restore in PHP? Jun 03, 2024 pm 12:19 PM

How to use MySQL backup and restore in PHP?

What should I do if my Win10 password does not meet the password policy requirements? What to do if my computer password does not meet the policy requirements? What should I do if my Win10 password does not meet the password policy requirements? What to do if my computer password does not meet the policy requirements? Jun 25, 2024 pm 04:59 PM

What should I do if my Win10 password does not meet the password policy requirements? What to do if my computer password does not meet the policy requirements?

What are the application scenarios of Java enumeration types in databases? What are the application scenarios of Java enumeration types in databases? May 05, 2024 am 09:06 AM

What are the application scenarios of Java enumeration types in databases?

How to insert data into a MySQL table using PHP? How to insert data into a MySQL table using PHP? Jun 02, 2024 pm 02:26 PM

How to insert data into a MySQL table using PHP?

How to fix mysql_native_password not loaded errors on MySQL 8.4 How to fix mysql_native_password not loaded errors on MySQL 8.4 Dec 09, 2024 am 11:42 AM

How to fix mysql_native_password not loaded errors on MySQL 8.4

See all articles