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

mysql 忘记root密码 如何解决

2015-03-11 23:59 429 查看
linux redhat6 &&mysql 5.6

第一步,关闭mysql服务

[root@ashe ~]# service mysqld stop

Shutting down MySQL. [确定]

第二步,以安全模式启动MySQL:

/usr/local/mysql/bin/mysqld_safe –skip-grant-tables &

然后会出现

[1] 7047

不要管它,回车键,回到命令行

[root@ashe ~]# 150312 07:54:04 mysqld_safe Logging to ‘/usr/local/mysql/data/ashe.err’.

150312 07:54:04 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

不要管它,回车键,回到命令行

[root@ashe ~]# mysql -uroot -p

Enter password: 这里直接回车,不要输入密码,

[root@ashe ~]# mysql -uroot -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.6.4-m7-log Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>

现在就可以登陆进去了。你可以进入mysql库,更改user表。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: