1.关闭数据库
shell>service mysql stop
2.使用mysqld_safe --skip-grant-tables 启动数据库
shell>mysqld_safe --skip-grant-tables &
4.使用空密码登陆数据库(mysql命令后直接回车)
shell>mysql
5.使用UPDATE语句修改ROOT密码
mysql>update user set password=password('1234')
where user='root';
6.关闭数据库并重新以正常方式启动数据库
shell>ps -ef|grep mysql
shell>kill -9 31634 31803
shell>service mysql start
shell>service mysql stop
2.使用mysqld_safe --skip-grant-tables 启动数据库
shell>mysqld_safe --skip-grant-tables &
4.使用空密码登陆数据库(mysql命令后直接回车)
shell>mysql
5.使用UPDATE语句修改ROOT密码
mysql>update user set password=password('1234')
where user='root';
6.关闭数据库并重新以正常方式启动数据库
shell>ps -ef|grep mysql
shell>kill -9 31634 31803
shell>service mysql start
本文介绍了一种在忘记MySQL数据库ROOT密码的情况下如何重置的方法。步骤包括:首先关闭数据库服务,然后以--skip-grant-tables参数启动MySQL,接着通过mysql客户端登录并更新root用户的密码。
1万+

被折叠的 条评论
为什么被折叠?



