Mysql入门Mysql5.6忘记root密码修改root密码的方法

Mysql入门Mysql5.6忘记root密码修改root密码的方法,第1张

概述介绍《Mysql入门Mysql5.6忘记root密码修改root密码的方法》开发教程,希望对您有用。

《MysqL入门MysqL5.6忘记root密码修改root密码的方法》要点:
本文介绍了MysqL入门MysqL5.6忘记root密码修改root密码的方法,希望对您有用。如果有疑问,可以联系我们。

MysqL5.6忘记数据库的root密码:MysqL入门

[root@oraserver139 ~]# MysqL -uroot -p
Enter password:
ERROR 1045 (28000): Access denIEd for user 'root'@'localhost' (using password: NO)MysqL入门

查看当前安装的MysqL版本:
MysqL入门

root@oraserver139 ~]# rpm -qa | grep MysqL
MysqL-server-5.6.15-1.el6.x86_64
MysqL-clIEnt-5.6.15-1.el6.x86_64
MysqL-shared-compat-5.6.15-1.el6.x86_64
MysqL-devel-5.6.15-1.el6.x86_64
perl-dbd-mysql-4.022-1.el6.rfx.x86_64MysqL入门

停止MysqL服务:
MysqL入门

[root@oraserver139 ~]# service MysqL stop
Shutting down MysqL.. SUCCESS!MysqL入门

进入到skip-grant-tables模式:MysqL入门

[root@oraserver139 ~]# MysqLd_safe --skip-grant-tables
140211 15:37:49 MysqLd_safe Logging to '/var/lib/MysqL/oraserver139.err'.
140211 15:37:49 MysqLd_safe Starting MysqLd daemon with databases from /var/lib/MysqLMysqL入门

现在就不需要密码就可以进入MysqL了:MysqL入门

[root@oraserver139 ~]# MysqL
Welcome to the MysqL monitor. Commands end with ; or \g.
Your MysqL connection ID is 1
Server version: 5.6.15 MysqL Community Server (GPL)MysqL入门

copyright (c) 2000,2013,Oracle and/or its affiliates. All rights reserved.MysqL入门

Oracle is a registered Trademark of Oracle Corporation and/or its
affiliates. Other names may be Trademarks of their respective
owners.MysqL入门

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MysqL入门

进入MysqL系统数据库:MysqL入门

MysqL> use MysqL
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changedMysqL入门

修改root账户密码:MysqL入门

MysqL> update user set password=password("12345") where user="root";
query OK,4 rows affected (0.02 sec)
Rows matched: 4 Changed: 4 Warnings: 0MysqL入门

刷新权限:MysqL入门

MysqL> flush privileges;
query OK,0 rows affected (0.00 sec)
MysqL> exit
ByeMysqL入门

停止MysqL进程:MysqL入门

[1]+ Stopped MysqLd_safe --skip-grant-tablesMysqL入门

启动MysqL:MysqL入门

[root@oraserver139 ~]# service MysqL start
Starting MysqL SUCCESS!MysqL入门

使用刚才修改的密码进入MysqL:MysqL入门

[root@oraserver139 ~]# MysqL -uroot -p12345
Warning: Using a password on the command line interface can be insecure.
Welcome to the MysqL monitor. Commands end with ; or \g.
Your MysqL connection ID is 3
Server version: 5.6.15MysqL入门

copyright (c) 2000,Oracle and/or its affiliates. All rights reserved.MysqL入门

Oracle is a registered Trademark of Oracle Corporation and/or its
affiliates. Other names may be Trademarks of their respective
owners.MysqL入门

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MysqL入门

MysqL> show databases;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statementMysqL入门

MysqL> SET PASSWORD = PASSWORD('12345');
query OK,0 rows affected (0.00 sec)MysqL入门

MysqL> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| MysqL |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)MysqL入门

修改完成;MysqL入门

以上所述是小编给大家介绍的MysqL5.6忘记root密码修改root密码的方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的.在此也非常感谢大家对内存溢出PHP网站的支持!MysqL入门

总结

以上是内存溢出为你收集整理的Mysql入门Mysql5.6忘记root密码修改root密码的方法全部内容,希望文章能够帮你解决Mysql入门Mysql5.6忘记root密码修改root密码的方法所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1163325.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-01
下一篇 2022-06-01

发表评论

登录后才能评论

评论列表(0条)

保存