Home  >  Article  >  Database  >  教你如何在MySQL 5数据库中重置root密码_MySQL

教你如何在MySQL 5数据库中重置root密码_MySQL

WBOY
WBOYOriginal
2016-06-01 14:03:32865browse
 

本文通过简洁的七步来设置MySQL 5.0数据库的root密码。

操作系统:DEBIAN Linux 3.1

MySQL数据库版本:5.0.27

 

(1)以 系统root权限登陆;

(2)停止MySQL服务器:MySQL.server stop;

 

(3)跳过授权表执行MySQL服务器:MySQLd_safe --skip-grant-tables --skip-networking &

(注:参数--skip-grant-tables为跳过授权表;--skip-networking为不监听TCP/IP连接);

 

(4)执行MySQL客户端:MySQL;

 

(5)使用MySQL数据库:use MySQL;

 

(6)更新root密码:update user set password=password('新密码') where user='root';

 

(7)关闭MySQL服务器,用正常方试起动。

 

本文非原创,也不是转贴,一部分是在书上看到的,一部分是在网上找的。如果您用的不是我这个版本,可以在MySQL的安装目录中找一个适合您当前版本的MySQLd_safe,后面加上--skip-grant-tables来跳过授权表。

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