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

UNIX下MySQL数据库root用户密码丢失,如何将其密码清空?

2010-08-25 16:59 260 查看
1.用root或者运行mysqld的用户登录系统;

2.利用service mysql stop将其结束;

3.使用--skip-grant-tables参数启动MySQL Server

shell>mysqld_safe --skip-grant-tables &

4.为root@localhost设置新密码

shell>mysqladmin -u root
mysql>use mysql;
mysql> update mysql.user set password=password("123456") where user="root";
shell>flush-privileges password "newpassword"

5.重启MySQL Server
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: