MySQL密码修改

 

一、 Windows:

1.用系统管理员登陆系统。

2.停止MySQL的服务cmd net stop mysql。
3.进入MySQL的安装目录
4.bin>mysqld-nt --skip-grant-tables
5.重新打开一个窗口,进入MySQL的安装目录,mysql -uroot
6.use mysql;
7.update user set password=password("newpassword") where user="username";
8.exit;
9.cmd net start mysq;
10.mysql -u root -p
11.newpassword

 

二、 linux

1. 修改MySQL的配置文件(默认为/etc/my.cnf),在[mysqld]下添加一行skip-grant-tables

2. 保存配置文件后,重启MySQL服务 service mysqld restart

3. MySQL -u root -p 直接回车

4. 同Windows第6步之后的操作,之后将配置文件改回。

 

posted @ 2009-01-24 16:50  dorothychai  阅读(113)  评论(0编辑  收藏  举报