Home  >  Article  >  Database  >  Mysql的忘記root密碼的重設_MySQL

Mysql的忘記root密碼的重設_MySQL

WBOY
WBOYOriginal
2016-06-01 13:11:171027browse

此文以Ubuntu為例。

1、修改Mysql的配置文件

# vim /etc/mysql/my.cnf   ### 也可能是/etc/my.cnf### 在[mysqld]一行下添加skip-grant-tables , 保存之後重啟mysql服務# service mysql restart

2、重設root密碼

# mysql -uroot -hlocalhost
mysql > use mysql;mysql > update user set Password=password(‘*****’) where user=’root’;mysql > flush privileges;mysql > quit;

 

3、重新修改還原mysql的配置文件

# vim /etc/mysql/my.cnf

註釋掉skip-grant-tables一行

# service restart


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
Previous article:mysql 学习_MySQLNext article:mysql的安装图解_MySQL