Home >Database >Mysql Tutorial >如果忘记了MySQL的root密码应当如何取回_MySQL

如果忘记了MySQL的root密码应当如何取回_MySQL

WBOY
WBOYOriginal
2016-06-01 13:53:49913browse

  问:如果忘记了MySQL的root密码应当如何取回?

  答:解决方法如下:

  在my.cnf的[mysqld]字段加入:

skip-grant-tables

  然后重启你的mysqld,这样久没有密码了.

  然后进入mysql。

UPDATE mysql.user SET Password=PASSWORD
('password') WHERE User='root';

  成功后

FLUSH PRIVILEGES;

  最后去掉my.cnf中的skip-grant-tables

  重启mysqld。

Statement:
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