Home >Database >Mysql Tutorial >命令行修改MYSQL密码_MySQL

命令行修改MYSQL密码_MySQL

WBOY
WBOYOriginal
2016-06-01 13:35:151099browse

bitsCN.com

命令行修改MYSQL密码

 

1、添加root密码

 

在dos目录下,输入:

 

[plain] 

mysqladmin -uroot -password 1234  

即为root添加密码1234

2、修改root密码

 

格式为:

 

[plain] 

mysqladmin -u用户名 -p旧密码 password 新密码  

修改root密码为4321

[plain] 

mysqladmin -uroot -p1234 password 4321  

 

3、在Mysql命令行中修改密码

[plain] 

mysql> UPDATE mysql.user SET password=PASSWORD(’4321’) WHERE User=’root’;  

mysql> FLUSH PRIVILEGES;  

4、显示当前user

[plain] 

mysql> SELECT USER();  

 

bitsCN.com
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