您的位置:首页 > 数据库 > MySQL

Mysql修改数据库密码

2017-10-03 17:49 288 查看

Mysql忘记密码,修改密码

vim /etc/my.cnf


在 [mysqld] 中加上一行跳过权限限制
skip-grant-tables


service mysqld restart


mysql -uroot -p
(直接点击回车,密码为空)

use mysql;


mysql> update user set password=password('123') where user='root';
//5.6

mysql> update user set authentication_string=password('new password') where user='root';
//5.7

mysql> flush privileges;


退出mysql 删除
skip-grant-tables


service mysqld restart


原文地址:http://biyongyao.com/archives/206
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: