知识
助手
最大化  清空记录  历史记录
   2270  
查询码: 00000181
Mysql5修改root账户密码
作者: 系统管理员 于 2018年09月23日 发布在分类 / 配置安装 / 数据库及SQL脚本 / mysql / 设置 ,于 2021年11月18日 编辑
mysql5

修改root账户密码
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpassword');
第一种方法:
mysqladmin -u root -pnewpass  password "redhat"

第二种方法:使用set password命令:
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
Query OK, 0 rows affected (0.00 sec)

第三种方法:使用update user直接登录数据库修改密码:
mysql> update user set password = password('newpass') where user = 'root';
Query OK, 5 rows affected (0.01 sec)
Rows matched: 5  Changed: 5  Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> \q
0人参与


 历史版本

修改日期 修改人 备注
2021-11-18 11:31:51[当前版本] 系统管理员 格式调整
2019-01-21 19:48:05 系统管理员 格式调整
2018-09-23 16:26:20 系统管理员 CREAT

wcp知识库系统-京ICP备15024440号-1 -V 5.1.3 -wcp