Home > Database > Mysql Tutorial > body text

Mysql的忘記root密碼的重設_MySQL

WBOY
Release: 2016-06-01 13:11:17
Original
1025 people have browsed it

此文以Ubuntu為例。

1、修改Mysql的配置文件

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

2、重設root密碼

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

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

# vim /etc/mysql/my.cnf
Copy after login

註釋掉skip-grant-tables一行

# service restart
Copy after login


source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!