Home > Database > Mysql Tutorial > MYSQL 修改root密码命令小结

MYSQL 修改root密码命令小结

WBOY
Release: 2016-06-07 18:05:33
Original
1208 people have browsed it

MYSQL 修改root密码命令小结,需要的朋友可以参考下。

一、请问在win2K命令提示符下怎样更改mysql的root管理员密码?

>mysql -u root -p
Enter password: ******
mysql> use mysql;
mysql> update user set password=password('new_password') where user='root';

通过这种方法就可以直接修改密码了。至于在CMD下能否登陆MySQL,就要在Windows环境变量PATH中添加“C:\Program Files\MySQL\MySQL Server 5.0\bin;”(请改为你自己的安装路径)了。

二、MYSQL 修改root密码命令

cmd下切换到 mysql 安装目录

d:/mysql/bin
前提:mysql用户root密码为空.
输入 mysql -u root mysql
mysql> 状态下输入 update user set password=password('新密码') where user='root';
回显
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0
mysql> 状态下输入 FLUSH PRIVILEGES;
回显
Query OK, 0 rows affected (0.00 sec)
mysql> 状态下输入 quit
退出 sql

注意每个命令后都要加上一个分号 ";"
mysql 才开始执行该行命令
而第二个指令会让已载入记忆体的 mysql 系统资料库更新

重起 mysql .
停止MYSQL
net stop mysql
开始MYSQL
net start mysql
Related labels:
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